public IEnumerable <Candidato> ListarCandidatos() { try { var lista = CandidatoBusiness.Listar(); return(lista); } catch (Exception ex) { throw ex; } }
public HttpResponseMessage Delete(int Id) { try { if (ModelState.IsValid) { CandidatoBusiness.Delete(Id); var candidatos = CandidatoBusiness.Listar(); var response = Request.CreateResponse(HttpStatusCode.OK, candidatos); return(response); } return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }