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 BrandEditorForm(BrandEditorModel model) { InitializeComponent(); _presenter = new BrandEditorPresenter(this, model); // set validation alignment valName.SetIconAlignment(txtName, System.Windows.Forms.ErrorIconAlignment.MiddleRight); valDescription.SetIconAlignment(txtDescription, System.Windows.Forms.ErrorIconAlignment.MiddleRight); this.Load += BrandEditorForm_Load; }
public ActionResult Create() { var model = new BrandEditorModel(); return(View(model)); }