public ActionResult Save(CustomerFormModel fm) { if (ModelState.IsValid) { var command = _mapper.Mapper.Map<CreateOrUpdateCustomerCommand>(fm); //IEnumerable<ValidationResult> errors = _commandBus.Validate(command); //ModelState.AddModelErrors(errors); if (ModelState.IsValid) { var result = _commandBus.Submit(command); if (result.Success) return RedirectToAction("Index"); } } return View(fm.CustomerId == 0 ? "Create" : "Edit", fm); }
public ActionResult Create() { var model = new CustomerFormModel() { IsActive = true }; return View(model); }