public void Edit(Entities.Cloth cloth) { using (var context = new ApplicationDbContext()) { context.Entry(cloth).State = EntityState.Modified; context.SaveChanges(); } }
public void Add(Entities.Cloth cloth) { using (var context = new ApplicationDbContext()) { context.Cloth.Add(cloth); context.SaveChanges(); } }
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(); } }