public HttpResponseMessage GetMetric(HttpRequestMessage request, int PerspectiveId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; ScoreCardPerspective scp = _MPRCoreService.GetScorecardPerspective(PerspectiveId); // notice no need to create a seperate model object since CaptionMapping entity will do just fine response = request.CreateResponse <ScoreCardPerspective>(HttpStatusCode.OK, scp); return response; })); }
public HttpResponseMessage UpdatePerspective(HttpRequestMessage request, [FromBody] ScoreCardPerspective scpModel) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; var scp = _MPRCoreService.UpdateScorecardPerspective(scpModel); //var response = request.CreateResponse<ScoreCardMetrics>(HttpStatusCode.OK, scm); response = request.CreateResponse <ScoreCardPerspective>(HttpStatusCode.OK, scp); return response; })); }
public HttpResponseMessage DeletePerspective(HttpRequestMessage request, [FromBody] int PerspectiveId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; // not that calling the WCF service here will authenticate access to the data ScoreCardPerspective scp = _MPRCoreService.GetScorecardPerspective(PerspectiveId); if (scp != null) { _MPRCoreService.DeleteScorecardPerspective(PerspectiveId); response = request.CreateResponse(HttpStatusCode.OK); } else { response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No Perspective found under the ID."); } return response; })); }