public Cloth Update(Cloth clothChange) { var cloth = context.Clothers.Attach(clothChange); cloth.State = Microsoft.EntityFrameworkCore.EntityState.Modified; context.SaveChanges(); return(clothChange); }
public Cloth Delete(int id) { Cloth cloth = context.Clothers.Find(id); if (cloth != null) { if (cloth.PhotoPath != null) { string filePath = System.IO.Path.Combine(_webHostEnvironment.WebRootPath, "images", cloth.PhotoPath); System.IO.File.Delete(filePath); } context.Clothers.Remove(cloth); context.SaveChanges(); } return(cloth); }
public Cloth Update(Cloth clothChange) { throw new NotImplementedException(); }
public Cloth Add(Cloth cloth) { context.Clothers.Add(cloth); context.SaveChanges(); return(cloth); }
public Cloth Add(Cloth cloth) { cloth.Id = _clothList.Max(e => e.Id) + 1; _clothList.Add(cloth); return(cloth); }