public static bool AddSaleGoodMap(SaleGoodMap saleGoodMap) { try { ApplicationDbContext db = new ApplicationDbContext(); db.SaleGoodMaps.Add(saleGoodMap); db.SaveChanges(); return(true); } catch { return(false); } }
public static bool RemoveSaleGoodMap(int id) { try { ApplicationDbContext db = new ApplicationDbContext(); SaleGoodMap saleGoodMap = db.SaleGoodMaps.FirstOrDefault(f => f.Id == id); db.SaleGoodMaps.Remove(saleGoodMap); db.SaveChanges(); return(true); } catch { return(false); } }
public static bool EditSaleGoodMap(SaleGoodMap saleGoodMap) { try { ApplicationDbContext db = new ApplicationDbContext(); SaleGoodMap v = db.SaleGoodMaps.FirstOrDefault(f => f.Id == saleGoodMap.Id); db.Entry(v).CurrentValues.SetValues(saleGoodMap); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }