public HttpResponseMessage GetMetric(HttpRequestMessage request, int WeightId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; ScoreCardWeight scw = _MPRCoreService.GetScoreCardWeight(WeightId); // notice no need to create a seperate model object since CaptionMapping entity will do just fine response = request.CreateResponse <ScoreCardWeight>(HttpStatusCode.OK, scw); return response; })); }
public HttpResponseMessage UpdateWeight(HttpRequestMessage request, [FromBody] ScoreCardWeight scwModel) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; ScoreCardWeight scw = _MPRCoreService.UpdateScoreCardWeight(scwModel); //var response = request.CreateResponse<ScoreCardMetrics>(HttpStatusCode.OK, scm); response = request.CreateResponse <ScoreCardWeight>(HttpStatusCode.OK, scw); return response; })); }
public HttpResponseMessage DeleteWeight(HttpRequestMessage request, [FromBody] int WeightId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; // not that calling the WCF service here will authenticate access to the data ScoreCardWeight scw = _MPRCoreService.GetScoreCardWeight(WeightId); if (scw != null) { _MPRCoreService.DeleteScoreCardWeight(WeightId); response = request.CreateResponse(HttpStatusCode.OK); } else { response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No Weight found under the ID."); } return response; })); }