public HttpResponseMessage UpdateSbu(HttpRequestMessage request, [FromBody] Sbu sbuModel) { return(GetHttpResponse(request, () => { var sbu = _MPRCoreService.UpdateSbu(sbuModel); return request.CreateResponse <Sbu>(HttpStatusCode.OK, sbu); })); }
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; })); }
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; })); }