Пример #1
0
 public void Update(T entity)
 {
     using (ToTheListContext db = new ToTheListContext())
     {
         db.Entry(entity).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Пример #2
0
 public void Create(T entity)
 {
     using (ToTheListContext db = new ToTheListContext())
     {
         db.Set <T>().Add(entity);
         db.SaveChanges();
     }
 }