public HttpResponseMessage GetMetric(HttpRequestMessage request, int MappingId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; ScoreCardMapping scm = _MPRCoreService.GetScoreCardMapping(MappingId); // notice no need to create a seperate model object since CaptionMapping entity will do just fine response = request.CreateResponse <ScoreCardMapping>(HttpStatusCode.OK, scm); return response; })); }
public HttpResponseMessage UpdateMapping(HttpRequestMessage request, [FromBody] ScoreCardMapping scmModel) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; var scm = _MPRCoreService.UpdateScoreCardMapping(scmModel); //var response = request.CreateResponse<ScoreCardMetrics>(HttpStatusCode.OK, scm); response = request.CreateResponse <ScoreCardMapping>(HttpStatusCode.OK, scm); return response; })); }
public HttpResponseMessage DeleteMapping(HttpRequestMessage request, [FromBody] int MappingId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; // not that calling the WCF service here will authenticate access to the data ScoreCardMapping scm = _MPRCoreService.GetScoreCardMapping(MappingId); if (scm != null) { _MPRCoreService.DeleteScoreCardMapping(MappingId); response = request.CreateResponse(HttpStatusCode.OK); } else { response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No Mapping found under the ID."); } return response; })); }