示例#1
0
        public static bool Add(Ashkhas shakhs)
        {
            try
            {
                using (FruitShopEntity db = new FruitShopEntity())
                {
                    db.Ashkhas.Add(shakhs);
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#2
0
        public static bool Update(Ashkhas shakhs)
        {
            try
            {
                using (FruitShopEntity db = new FruitShopEntity())
                {
                    var model = db.Ashkhas.Single(x => x.AshkhasID == shakhs.AshkhasID);
                    model.Name     = shakhs.Name;
                    model.CodeMeli = shakhs.CodeMeli;
                    model.Family   = shakhs.Family;
                    model.Tel      = shakhs.Tel;
                    model.Mobile   = shakhs.Mobile;
                    model.Address  = shakhs.Address;
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }