public HttpResponseMessage UpdateCDQMProduct(HttpRequestMessage request, [FromBody] CDQMProduct cdqmProductModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var cdqmProduct = _CDQMService.UpdateCDQMProduct(cdqmProductModel);

                return request.CreateResponse <CDQMProduct>(HttpStatusCode.OK, cdqmProduct);
            }));
        }
        public HttpResponseMessage GetCDQMProduct(HttpRequestMessage request, int cdqmProductId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                CDQMProduct cdqmProduct = _CDQMService.GetCDQMProduct(cdqmProductId);

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

                return response;
            }));
        }
        public HttpResponseMessage DeleteCDQMProduct(HttpRequestMessage request, [FromBody] int cdqmProductId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                CDQMProduct cdqmProduct = _CDQMService.GetCDQMProduct(cdqmProductId);

                if (cdqmProduct != null)
                {
                    _CDQMService.DeleteCDQMProduct(cdqmProductId);

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

                return response;
            }));
        }
Beispiel #4
0
 public CDQMProduct UpdateCDQMProduct(CDQMProduct cdqmProduct)
 {
     return(Channel.UpdateCDQMProduct(cdqmProduct));
 }