Example #1
0
 public void Edit(Entities.Cloth cloth)
 {
     using (var context = new ApplicationDbContext())
     {
         context.Entry(cloth).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #2
0
 public void Add(Entities.Cloth cloth)
 {
     using (var context = new ApplicationDbContext())
     {
         context.Cloth.Add(cloth);
         context.SaveChanges();
     }
 }
Example #3
0
 public void Delete(Entities.Cloth cloth)
 {
     using (var context = new ApplicationDbContext())
     {
         var deleteItem = context.Cloth.FirstOrDefault(a => a.Id == cloth.Id);
         if (deleteItem == null)
         {
             return;
         }
         context.Cloth.Remove(deleteItem);
         context.SaveChanges();
     }
 }