Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public ActionResult Create()
 {
     var model = new CustomerFormModel() { IsActive = true };
     return View(model);
 }