public HttpResponseMessage GetRantById(int Id) { var repo = new RantsRepository(); var result = repo.GetRant(Id); return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage ListRants() { var repo = new RantsRepository(); List <Rant> rants = repo.GetAll(); return(Request.CreateResponse(HttpStatusCode.OK, rants)); }
public HttpResponseMessage DeleteRant(int Id) { var repository = new RantsRepository(); var result = repository.Delete(Id); if (result) { return(Request.CreateResponse(HttpStatusCode.OK)); } return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Could not delete rant, please try again later.")); }
public HttpResponseMessage AddRant(AddRantDTO rant) { var repository = new RantsRepository(); var result = repository.Create(rant); if (result) { return(Request.CreateResponse(HttpStatusCode.Created)); } return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Customer could not be created, please try again later.")); }
public HttpResponseMessage UpdateRant(Rant rant, int Id) { rant.Id = Id; var repository = new RantsRepository(); var result = repository.Update(rant); if (result) { return(Request.CreateResponse(HttpStatusCode.OK)); } return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Could not update rant information, please try again later.")); }