Example #1
0
        public HttpResponseMessage UpdateCaptionMapping(HttpRequestMessage request, [FromBody] CaptionMapping captionMappingModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var captionMapping = _MPRCoreService.UpdateCaptionMapping(captionMappingModel);

                return request.CreateResponse <CaptionMapping>(HttpStatusCode.OK, captionMapping);
            }));
        }
Example #2
0
        public HttpResponseMessage GetCaptionMapping(HttpRequestMessage request, int captionMappingId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                CaptionMapping captionMapping = _MPRCoreService.GetCaptionMapping(captionMappingId);

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

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

                // not that calling the WCF service here will authenticate access to the data
                CaptionMapping captionMapping = _MPRCoreService.GetCaptionMapping(captionMappingId);

                if (captionMapping != null)
                {
                    _MPRCoreService.DeleteCaptionMapping(captionMappingId);

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

                return response;
            }));
        }