public async Task <ICommandResult> Handler(ActiveNurseCommand command) { command.Validate(); if (command.Invalid) { return(new GenericCommandResult(false, "Ops, parece que algo esta errado!", command.Notifications)); } var nurse = await _nurseRepository.GetById(command.Id); nurse.ActiveNurse(); await _nurseRepository.Update(nurse); return(new GenericCommandResult(true, "Dados do enfermeiro atualizado", nurse)); }
public async Task <IActionResult> Enable([FromBody] ActiveNurseCommand command, [FromServices] NurseHandler handler) { return(Ok(await handler.Handler(command))); }