public ActionResult Create(ClientModel clientModel) { if (!ModelState.IsValid) { return(this.RedirectToAction(f => f.New())); } Client client = new Client(); client.Name = clientModel.Name; _clientCommandRepository.Add(client); return(this.RedirectToAction <HomeController>(f => f.Index())); }
public void Handle(ClientCreateCommand command) { Client client = new Client(); client.Name = command.Name; _clientCommandRepository.Add(client); }
public ActionResult Create(ClientModel clientModel) { if (!ModelState.IsValid) { return(View("New", clientModel)); } Client client = new Client(); client.Name = clientModel.Name; _clientCommandRepository.Add(client); return(RedirectToAction("Index", "ClientList")); }