public ActionResult <GenericCommandResult> Delete( [FromBody] DeleteMembroFamiliarCommand command ) { //command.User = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value; command.ChaveDeAcesso = "xpto123t"; return(Ok((GenericCommandResult)_handler.Handle(command))); }
public ICommandResult Handle(DeleteMembroFamiliarCommand command) { command.Validate(); if (command.Invalid) { return(new GenericCommandResult(false, "Ops, Alguma inconsistencia nos dados", command.Notifications)); } var membro = _membroRepository.GetById(command.Id, command.ChaveDeAcesso); _membroRepository.Delete(membro.Id); return(new GenericCommandResult(true, $"O membro {membro.Nome.ToString()} foi excluida com Sucesso!", membro)); }