Example #1
0
        public HttpResponseMessage UpdateNotchDifference(HttpRequestMessage request, [FromBody] NotchDifference notchDifferenceModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var notchDifference = _IFRS9Service.UpdateNotchDifference(notchDifferenceModel);

                return request.CreateResponse <NotchDifference>(HttpStatusCode.OK, notchDifference);
            }));
        }
Example #2
0
        public HttpResponseMessage GetNotchDifference(HttpRequestMessage request, int notchDifferenceId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                NotchDifference notchDifference = _IFRS9Service.GetNotchDifference(notchDifferenceId);

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

                return response;
            }));
        }
Example #3
0
        public HttpResponseMessage DeleteNotchDifference(HttpRequestMessage request, [FromBody] int notchDifferenceId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                NotchDifference notchDifference = _IFRS9Service.GetNotchDifference(notchDifferenceId);

                if (notchDifference != null)
                {
                    _IFRS9Service.DeleteNotchDifference(notchDifferenceId);

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

                return response;
            }));
        }