예제 #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);
            }
        }
예제 #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);
            }
        }