Exemplo n.º 1
0
        public async Task <string> CreateOrUpdate([FromBody] EmployeeCreateOrUpdateCommand model)
        {
            await _handler.Handle(model);

            return(JsonConvert.SerializeObject(new
            {
                sucess = !model.Failures.Any(),
                erros = model.Failures
            }));
        }
Exemplo n.º 2
0
        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"));
        }