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

                AutoPostingTemplate autoPostingTemplate = _FinstatService.GetAutoPostingTemplate(autoPostingTemplateId);

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

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

                // not that calling the WCF service here will authenticate access to the data
                AutoPostingTemplate autoPostingTemplate = _FinstatService.GetAutoPostingTemplate(autoPostingTemplateId);

                if (autoPostingTemplate != null)
                {
                    _FinstatService.DeleteAutoPostingTemplate(autoPostingTemplateId);

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

                return response;
            }));
        }
예제 #3
0
 public AutoPostingTemplate UpdateAutoPostingTemplate(AutoPostingTemplate autoPostingTemplate)
 {
     return(Channel.UpdateAutoPostingTemplate(autoPostingTemplate));
 }
        public HttpResponseMessage UpdateAutoPostingTemplate(HttpRequestMessage request, [FromBody] AutoPostingTemplate autoPostingTemplateModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var autoPostingTemplate = _FinstatService.UpdateAutoPostingTemplate(autoPostingTemplateModel);

                return request.CreateResponse <AutoPostingTemplate>(HttpStatusCode.OK, autoPostingTemplate);
            }));
        }