コード例 #1
0
 public static List <CategoryModel> GetCategories(int year)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         return(dbContext.Categories.AsNoTracking().ToList());
     }
 }
コード例 #2
0
 public static CategoryModel GetCategory(int year, int CategoryNb)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         return(dbContext.Categories.AsNoTracking().FirstOrDefault(g => g.CategoryNb == CategoryNb));
     }
 }
コード例 #3
0
ファイル: GuestRepository.cs プロジェクト: cgenin7/Jojoscar
 public static void DeleteGuest(int year, int guestId)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Database.ExecuteSqlCommand("exec DeleteGuest @guestId = {0}", guestId);
     }
 }
コード例 #4
0
ファイル: GuestRepository.cs プロジェクト: cgenin7/Jojoscar
 public static GuestModel GetGuest(int year, int guestId)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         return(dbContext.Guests.AsNoTracking().FirstOrDefault(g => g.GuestID == guestId));
     }
 }
コード例 #5
0
ファイル: GuestRepository.cs プロジェクト: cgenin7/Jojoscar
 public static List <GuestModel> GetGuests(int year)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         return(dbContext.Guests.AsNoTracking().ToList());
     }
 }
コード例 #6
0
 public static void EditCategory(int year, CategoryModel CategoryToModify)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Entry(CategoryToModify).State = EntityState.Modified;
         dbContext.SaveChanges();
     }
 }
コード例 #7
0
 public static void DeleteCategory(int year, int categoryId)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Database.ExecuteSqlCommand("exec DeleteCategory @categoryId = {0}", categoryId);
         dbContext.SaveChanges();
     }
 }
コード例 #8
0
 public static void AddCategory(int year, CategoryModel CategoryToAdd)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Categories.Add(CategoryToAdd);
         dbContext.SaveChanges();
     }
 }
コード例 #9
0
ファイル: GuestRepository.cs プロジェクト: cgenin7/Jojoscar
 public static void EditGuest(int year, GuestModel guestToModify)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Entry(guestToModify).State = EntityState.Modified;
         dbContext.SaveChanges();
     }
 }
コード例 #10
0
ファイル: GuestRepository.cs プロジェクト: cgenin7/Jojoscar
 public static void AddGuest(int year, GuestModel guestToAdd)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Guests.Add(guestToAdd);
         dbContext.SaveChanges();
     }
 }
コード例 #11
0
 public static void ReplaceCategoryNominees(int year, List <CategoryNomineeModel> nominees)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.CategoryNominees.RemoveRange(dbContext.CategoryNominees);
         dbContext.CategoryNominees.AddRange(nominees);
         dbContext.SaveChanges();
     }
 }