Exemple #1
0
        public HttpResponseMessage UpdateSbu(HttpRequestMessage request, [FromBody] Sbu sbuModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var sbu = _MPRCoreService.UpdateSbu(sbuModel);

                return request.CreateResponse <Sbu>(HttpStatusCode.OK, sbu);
            }));
        }
Exemple #2
0
        public HttpResponseMessage GetSbu(HttpRequestMessage request, int sbuId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                Sbu sbu = _MPRCoreService.GetSbu(sbuId);

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

                return response;
            }));
        }
Exemple #3
0
        public HttpResponseMessage DeleteSbu(HttpRequestMessage request, [FromBody] int sbuId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                Sbu sbu = _MPRCoreService.GetSbu(sbuId);

                if (sbu != null)
                {
                    _MPRCoreService.DeleteSbu(sbuId);

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

                return response;
            }));
        }