public HttpResponseMessage GetIncomeProductstable(HttpRequestMessage request, int iptTreasuryId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                IncomeProductsTableTreasury ipt = _MPRIncomeService.GetIncomeProductsTableTreasury(iptTreasuryId);

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

                return response;
            }));
        }
        public HttpResponseMessage DeleteIncomeProductsTableTreasury(HttpRequestMessage request, [FromBody] int iptTreasuryId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                IncomeProductsTableTreasury ipt = _MPRIncomeService.GetIncomeProductsTableTreasury(iptTreasuryId);

                if (ipt != null)
                {
                    _MPRIncomeService.DeleteIncomeProductsTableTreasury(iptTreasuryId);

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                else
                {
                    response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No IncomeProduct table treasury found under the ID.");
                }

                return response;
            }));
        }
Exemplo n.º 3
0
 public IncomeProductsTableTreasury UpdateIncomeProductsTableTreasury(IncomeProductsTableTreasury iptTreasury)
 {
     return(Channel.UpdateIncomeProductsTableTreasury(iptTreasury));
 }
        public HttpResponseMessage UpdateIncomeProductsTableTreasury(HttpRequestMessage request, [FromBody] IncomeProductsTableTreasury iptTreasuryModel)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                var iptTreasury = _MPRIncomeService.UpdateIncomeProductsTableTreasury(iptTreasuryModel);

                response = request.CreateResponse <IncomeProductsTableTreasury>(HttpStatusCode.OK, iptTreasury);

                return response;
            }));
        }