Beispiel #1
0
 public void AddBrand(Model.BrandInfo model)
 {
     Context.BrandInfo.Add(model);
     Context.SaveChanges();
     //转移图片
     model.Logo = MoveImages(model.Id, model.Logo);
     Context.SaveChanges();
 }
Beispiel #2
0
        public void UpdateBrand(Model.BrandInfo model)
        {
            model.Logo = MoveImages(model.Id, model.Logo);
            BrandInfo brand = GetBrand(model.Id);

            brand.Name             = model.Name.Trim();
            brand.Description      = model.Description;
            brand.Logo             = model.Logo;
            brand.Meta_Description = model.Meta_Description;
            brand.Meta_Keywords    = model.Meta_Keywords;
            brand.Meta_Title       = model.Meta_Title;
            brand.RewriteName      = model.RewriteName;
            brand.IsRecommend      = model.IsRecommend;

            ShopBrandApplysInfo info = Context.ShopBrandApplysInfo.FirstOrDefault(p => p.BrandId == model.Id);

            if (info != null)
            {
                info.BrandName   = model.Name;
                info.Description = model.Description;
                info.Logo        = model.Logo;
            }
            Context.SaveChanges();
        }