Exemple #1
0
        public static bool Add(BarNameh bar)
        {
            try
            {
                using (FruitShopEntity db = new FruitShopEntity())
                {
                    db.BarNamehs.Add(bar);
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #2
0
        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);
            }
        }