public HttpResponseMessage UpdateExpenseBasis(HttpRequestMessage request, [FromBody] ExpenseBasis expenseBasisModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var expenseBasis = _MPROPEXService.UpdateExpenseBasis(expenseBasisModel);

                return request.CreateResponse <ExpenseBasis>(HttpStatusCode.OK, expenseBasis);
            }));
        }
        public HttpResponseMessage GetExpenseBasisByCode(HttpRequestMessage request, string code)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                ExpenseBasis expenseBasis = _MPROPEXService.GetAllExpenseBasisInfo().Where(c => c.Code == code).FirstOrDefault();

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

                return response;
            }));
        }
        public HttpResponseMessage GetExpenseBasis(HttpRequestMessage request, int expenseBasisId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                ExpenseBasis expenseBasis = _MPROPEXService.GetExpenseBasis(expenseBasisId);

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

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

                // not that calling the WCF service here will authenticate access to the data
                ExpenseBasis expenseBasis = _MPROPEXService.GetExpenseBasis(expenseBasisId);

                if (expenseBasis != null)
                {
                    _MPROPEXService.DeleteExpenseBasis(expenseBasisId);

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

                return response;
            }));
        }
Example #5
0
 public ExpenseBasis UpdateExpenseBasis(ExpenseBasis expenseBasis)
 {
     return(Channel.UpdateExpenseBasis(expenseBasis));
 }