public static bool Add(BarNameh bar) { try { using (FruitShopEntity db = new FruitShopEntity()) { db.BarNamehs.Add(bar); db.SaveChanges(); } return(true); } catch (Exception) { return(false); } }
public static bool Update(BarNameh bar) { try { using (FruitShopEntity db = new FruitShopEntity()) { var model = db.BarNamehs.Single(x => x.BarNamehID == bar.BarNamehID); model.GhimatKol = bar.GhimatKol; db.SaveChanges(); } return(true); } catch (Exception) { return(false); } }