public HttpResponseMessage GetHistoricalSectorRating(HttpRequestMessage request, int historicalSectorRatingId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; HistoricalSectorRating historicalSectorRating = _IFRS9Service.GetHistoricalSectorRating(historicalSectorRatingId); // notice no need to create a seperate model object since HistoricalSectorRating entity will do just fine response = request.CreateResponse <HistoricalSectorRating>(HttpStatusCode.OK, historicalSectorRating); return response; })); }
public HttpResponseMessage DeleteHistoricalSectorRating(HttpRequestMessage request, [FromBody] int historicalSectorRatingId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; // not that calling the WCF service here will authenticate access to the data HistoricalSectorRating historicalSectorRating = _IFRS9Service.GetHistoricalSectorRating(historicalSectorRatingId); if (historicalSectorRating != null) { _IFRS9Service.DeleteHistoricalSectorRating(historicalSectorRatingId); response = request.CreateResponse(HttpStatusCode.OK); } else { response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No historicalSectorRating found under that ID."); } return response; })); }
public HttpResponseMessage UpdateHistoricalSectorRating(HttpRequestMessage request, [FromBody] HistoricalSectorRating historicalSectorRatingModel) { return(GetHttpResponse(request, () => { var historicalSectorRating = _IFRS9Service.UpdateHistoricalSectorRating(historicalSectorRatingModel); return request.CreateResponse <HistoricalSectorRating>(HttpStatusCode.OK, historicalSectorRating); })); }