Inheritance: ILocalizable
Esempio n. 1
0
 public BrandRowModel(Brand brand)
 {
     this.Id = brand.Id;
     this.Name = brand.Name;
     this.Description = brand.Description;
     this.Logo = brand.Logo;
 }
Esempio n. 2
0
        public ActionResult Save(BrandEditorModel model, string @return)
        {
            model.CustomFields = FormHelper.BindToModels<BrandCustomFieldModel>(Request.Form, "CustomFields.");
            Brand brand = new Brand();
            model.UpdateTo(brand);
            _brandService.Save(brand);

            return AjaxForm().RedirectTo(@return);
        }
Esempio n. 3
0
        public BrandEditorModel(Brand brand)
        {
            this.Id = brand.Id;
            this.Name = brand.Name;
            this.Description = brand.Description;
            this.Logo = brand.Logo;
            this.CustomFields = new List<BrandCustomFieldModel>();
            if(brand.CustomFields != null && brand.CustomFields.Count > 0)
            {
               foreach(var cf in brand.CustomFields)
               {
                   var cfm = new BrandCustomFieldModel();
                   cfm.Name = cf.Name;
                   cfm.Value = cf.Value;

                   this.CustomFields.Add(cfm);
               }
            }
        }
Esempio n. 4
0
        public void UpdateTo(Brand brand)
        {
            brand.Id = this.Id;
            brand.Name = (this.Name ?? string.Empty).Trim();
            brand.Description = (this.Description ?? string.Empty).Trim();
            brand.Logo = (this.Logo ?? string.Empty).Trim();

            if(this.CustomFields != null && this.CustomFields.Count > 0)
            {
                brand.CustomFields = new List<BrandCustomField>();
                foreach (var cfm in this.CustomFields)
                {
                    var cf = new BrandCustomField();
                    cf.BrandId = this.Id;
                    cf.Name = cfm.Name;
                    cf.Value = cfm.Value;

                    brand.CustomFields.Add(cf);
                }
            }
        }
Esempio n. 5
0
 public BrandCreated(Brand brand)
 {
     BrandId = brand.Id;
 }
Esempio n. 6
0
 public void Update(Brand brand)
 {
     _instance.Database.Repository<Brand>().Update(brand);
     Event.Raise(new BrandUpdated(brand), _instance);
 }
Esempio n. 7
0
 public void Create(Brand brand)
 {
     _instance.Database.Insert(brand);;
     Event.Raise(new BrandCreated(brand), _instance);
 }
Esempio n. 8
0
 public BrandGridItemModel(Brand brand)
 {
     Id = brand.Id;
     Name = brand.Name;
 }
Esempio n. 9
0
 public BrandDeleted(Brand brand)
 {
     BrandId = brand.Id;
     BrandName = brand.Name;
 }
Esempio n. 10
0
        public ActionResult Save(BrandEditorModel model, string @return)
        {
            Brand brand = null;

            if (model.Id > 0)
            {
                brand = _brandService.Find(model.Id);
            }
            else
            {
                brand = new Brand();
            }

            brand.Name = model.Name;
            brand.Description = model.Description;

            brand.CustomFields.Clear();

            foreach (var field in model.CustomFields)
            {
                brand.CustomFields.Add(new BrandCustomField(field.Name, field.Value));
            }

            if (model.Id > 0)
            {
                _brandService.Update(brand);
            }
            else
            {
                _brandService.Create(brand);
            }

            return AjaxForm().RedirectTo(@return);
        }
Esempio n. 11
0
 public BrandUpdated(Brand brand)
 {
     BrandId = brand.Id;
 }
Esempio n. 12
0
 public BrandModel(Brand brand)
 {
     Id = brand.Id;
     Name = brand.Name;
     Description = brand.Description;
 }