public async Task <string> CreateOrUpdate([FromBody] EmployeeCreateOrUpdateCommand model) { await _handler.Handle(model); return(JsonConvert.SerializeObject(new { sucess = !model.Failures.Any(), erros = model.Failures })); }
public async Task <IActionResult> Create(CreateEmployeeCommand employee) { var result = (CreateEmployeeCommandResult)EmployeeHandler.Handle(employee).GetAwaiter().GetResult(); if (!result.Validation) { ViewBag.Validation = EmployeeHandler.Notifications.Select(x => x.Message); return(View(employee)); } return(RedirectToAction("Index")); }