public HttpResponseMessage GetWhiskeyListByUser(int userId) { var repository = new WhiskeyRepository(); var result = repository.ListAllWhiskeysByUser(userId); return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage DeleteWhiskey(int id) { var repo = new WhiskeyRepository(); var result = repo.Delete(id); return(result ? Request.CreateResponse(HttpStatusCode.OK) : Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Whiskey can't be deleted")); }
public HttpResponseMessage AddWhiskeys(WhiskeyDTO Whiskey) { var repository = new WhiskeyRepository(); var result = repository.Create(Whiskey); if (result) { return(Request.CreateResponse(HttpStatusCode.Created)); } return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "no!")); }