示例#1
0
 public bool AddProductBrand(DataBase.Entities.Brand brand)
 {
     using (var db = new StoreContext(null))
     {
         db.Brands.Add(brand);
         try
         {
             db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
示例#2
0
        public bool UpdateBrand(DataBase.Entities.Brand brand, int brandId)
        {
            using (var db = new StoreContext(null))
            {
                try
                {
                    var result = db.Brands.Where(x => x.BrandId == brand.BrandId).First();

                    result.Description = brand.Description;
                    result.EName       = brand.EName;
                    result.Name        = brand.Name;

                    db.SaveChanges();
                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }