public ActionResult DeleteById( [FromServices] DataContext context, int id) { try { var service = new ContratoService(new ContratoRepository(context), new PrestacaoRepository(context)); service.Delete(id); return(Ok("Deletado com sucesso!")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }