public BrandRowModel(Brand brand) { this.Id = brand.Id; this.Name = brand.Name; this.Description = brand.Description; this.Logo = brand.Logo; }
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); }
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); } } }
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); } } }
public BrandCreated(Brand brand) { BrandId = brand.Id; }
public void Update(Brand brand) { _instance.Database.Repository<Brand>().Update(brand); Event.Raise(new BrandUpdated(brand), _instance); }
public void Create(Brand brand) { _instance.Database.Insert(brand);; Event.Raise(new BrandCreated(brand), _instance); }
public BrandGridItemModel(Brand brand) { Id = brand.Id; Name = brand.Name; }
public BrandDeleted(Brand brand) { BrandId = brand.Id; BrandName = brand.Name; }
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); }
public BrandUpdated(Brand brand) { BrandId = brand.Id; }
public BrandModel(Brand brand) { Id = brand.Id; Name = brand.Name; Description = brand.Description; }