public HttpResponseMessage GetCountryId(string CountryId) { try { DbLibrary dbLibrary = new DbLibrary(); BO_Author boAuthor = new BO_Author(dbLibrary); DataMessage dataMessage = new DataMessage(boAuthor.GetCountryId(CountryId)); return(Request.CreateResponse(HttpStatusCode.OK, dataMessage)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Excepción en la obtención del Id: " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.BadRequest, mensaje)); } }
public HttpResponseMessage Put([FromBody] Author author) { try { DbLibrary dbLibrary = new DbLibrary(); BO_Author boAuthor = new BO_Author(dbLibrary); DataMessage dataMessage = new DataMessage(boAuthor.Update(author)); return(Request.CreateResponse(HttpStatusCode.OK, dataMessage)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Excepción en la actualización del registro: " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.BadRequest, mensaje)); } }
public HttpResponseMessage PutState(int AuthorId, bool State) { try { DbLibrary dbLibrary = new DbLibrary(); BO_Author boAuthor = new BO_Author(dbLibrary); DataMessage dataMessage = new DataMessage(boAuthor.ChangeState(AuthorId, State)); return(Request.CreateResponse(HttpStatusCode.OK, dataMessage)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Excepción en el cambio de estado del registro: " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.BadRequest, mensaje)); } }