You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

46 lines
1.2 KiB

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using static DiscoBot.calendar.Calendar;
namespace DiscoBot.calendar
{
public class CalendarContext : DbContext
{
private ulong guildId;
public DbSet<CalendarItem> CalendarItems { get; set; }
public CalendarContext(ulong guildId)
{
this.guildId = guildId;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Data Source=" + guildId + "-calendar.db");
}
}
public class CalendarItemAttendance
{
[Key]
public ulong Id { get; set; }
public ulong Attendee { get; set; }
public Attendance Attending { get; set; }
}
public class CalendarItem
{
[Key]
public ulong Id { get; set; }
public string Name { get; set; }
public ulong Channel { get; set; }
public DateTimeOffset Date { get; set; }
public string Comment { get; set; }
public List<CalendarItemAttendance> Attendance { get; set; }
}
}