Пример #1
0
 public static void EditCategory(int year, CategoryModel CategoryToModify)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Entry(CategoryToModify).State = EntityState.Modified;
         dbContext.SaveChanges();
     }
 }
Пример #2
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();
     }
 }
Пример #3
0
 public static void AddCategory(int year, CategoryModel CategoryToAdd)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Categories.Add(CategoryToAdd);
         dbContext.SaveChanges();
     }
 }
Пример #4
0
 public static void EditGuest(int year, GuestModel guestToModify)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Entry(guestToModify).State = EntityState.Modified;
         dbContext.SaveChanges();
     }
 }
Пример #5
0
 public static void AddGuest(int year, GuestModel guestToAdd)
 {
     using (var dbContext = new JojoscarDbContext(year))
     {
         dbContext.Guests.Add(guestToAdd);
         dbContext.SaveChanges();
     }
 }
Пример #6
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();
     }
 }