示例#1
0
        public HttpResponseMessage UpdateExternalRating(HttpRequestMessage request, [FromBody] ExternalRating externalRatingModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var externalRating = _IFRS9Service.UpdateExternalRating(externalRatingModel);

                return request.CreateResponse <ExternalRating>(HttpStatusCode.OK, externalRating);
            }));
        }
示例#2
0
        public HttpResponseMessage GetExternalRating(HttpRequestMessage request, int externalRatingId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                ExternalRating externalRating = _IFRS9Service.GetExternalRating(externalRatingId);

                // notice no need to create a seperate model object since ExternalRating entity will do just fine
                response = request.CreateResponse <ExternalRating>(HttpStatusCode.OK, externalRating);

                return response;
            }));
        }
示例#3
0
        public HttpResponseMessage DeleteExternalRating(HttpRequestMessage request, [FromBody] int externalRatingId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                ExternalRating externalRating = _IFRS9Service.GetExternalRating(externalRatingId);

                if (externalRating != null)
                {
                    _IFRS9Service.DeleteExternalRating(externalRatingId);

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                else
                {
                    response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No externalRating found under that ID.");
                }

                return response;
            }));
        }