Example #1
0
        public HttpResponseMessage GetCostCentreDefinition(HttpRequestMessage request, int ccDefinitionId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                CostCentreDefinition costCentreDefinition = _MPROPEXService.GetCostCentreDefinition(ccDefinitionId);

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

                return response;
            }));
        }
Example #2
0
        public HttpResponseMessage DeleteCostCentreDefinition(HttpRequestMessage request, [FromBody] int ccDefinitionId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                CostCentreDefinition costCentreDefinition = _MPROPEXService.GetCostCentreDefinition(ccDefinitionId);

                if (costCentreDefinition != null)
                {
                    _MPROPEXService.DeleteCostCentreDefinition(ccDefinitionId);

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

                return response;
            }));
        }
Example #3
0
        public HttpResponseMessage UpdateCostCentreDefinition(HttpRequestMessage request, [FromBody] CostCentreDefinition costCentreDefinitionModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var costCentreDefinition = _MPROPEXService.UpdateCostCentreDefinition(costCentreDefinitionModel);

                return request.CreateResponse <CostCentreDefinition>(HttpStatusCode.OK, costCentreDefinition);
            }));
        }
Example #4
0
 public CostCentreDefinition UpdateCostCentreDefinition(CostCentreDefinition costCentreDefinition)
 {
     return(Channel.UpdateCostCentreDefinition(costCentreDefinition));
 }