예제 #1
0
        public HttpResponseMessage UpdateClient(HttpRequestMessage request, [FromBody] CodeEntities.Client clientModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var client = _CoreService.UpdateClient(clientModel);

                return request.CreateResponse <CodeEntities.Client>(HttpStatusCode.OK, client);
            }));
        }
예제 #2
0
        public HttpResponseMessage GetClient(HttpRequestMessage request, int clientId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                CodeEntities.Client client = _CoreService.GetClient(clientId);

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

                return response;
            }));
        }
예제 #3
0
        public HttpResponseMessage DeleteClient(HttpRequestMessage request, [FromBody] int clientId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                CodeEntities.Client client = _CoreService.GetClient(clientId);

                if (client != null)
                {
                    _CoreService.DeleteClient(clientId);

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

                return response;
            }));
        }
 public coreEntities.Client UpdateClient(coreEntities.Client client)
 {
     return Channel.UpdateClient(client);
 }