public IActionResult Delete(int id, [FromServices] ICompromissoRepository repository) { try { var compromisso = repository.ObterPorId(id); repository.Excluir(compromisso); return(Ok("Compromisso excluido com sucesso.")); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public IActionResult GetById(int id, [FromServices] ICompromissoRepository repository, [FromServices] IMapper mapper) { try { var model = mapper.Map <CompromissoConsultaModel> (repository.ObterPorId(id)); return(Ok(model)); } catch (Exception e) { return(StatusCode(500, e.Message)); } }