コード例 #1
0
        public HttpResponseMessage GetExpenseProductMapping(HttpRequestMessage request, int expenseProductId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                ExpenseProductMapping expenseProductMapping = _MPROPEXService.GetExpenseProductMapping(expenseProductId);

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

                return response;
            }));
        }
コード例 #2
0
        public HttpResponseMessage DeleteExpenseProductMapping(HttpRequestMessage request, [FromBody] int expenseProductId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                ExpenseProductMapping expenseProductMapping = _MPROPEXService.GetExpenseProductMapping(expenseProductId);

                if (expenseProductMapping != null)
                {
                    _MPROPEXService.DeleteExpenseProductMapping(expenseProductId);

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

                return response;
            }));
        }
コード例 #3
0
        public HttpResponseMessage UpdateExpenseProductMapping(HttpRequestMessage request, [FromBody] ExpenseProductMapping expenseProductMappingModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var expenseProductMapping = _MPROPEXService.UpdateExpenseProductMapping(expenseProductMappingModel);

                return request.CreateResponse <ExpenseProductMapping>(HttpStatusCode.OK, expenseProductMapping);
            }));
        }
コード例 #4
0
 public ExpenseProductMapping UpdateExpenseProductMapping(ExpenseProductMapping expenseProductMapping)
 {
     return(Channel.UpdateExpenseProductMapping(expenseProductMapping));
 }