public HttpResponseMessage Put(string applicationReference, Application application) { Check.If(applicationReference).IsNotNullOrEmpty(); Check.If(application).IsNotNull(); var result = _applicationService.UpdateApplication(applicationReference, Mapper.Map<Core.Objects.Application>(application)); return result ? new HttpResponseMessage {StatusCode = HttpStatusCode.OK} : new HttpResponseMessage {StatusCode = HttpStatusCode.InternalServerError}; }
public HttpResponseMessage Post(Application application) { Check.If(application).IsNotNull(); var result = _applicationService.CreateApplication(Mapper.Map<Core.Objects.Application>(application)); if (result == null) { return new HttpResponseMessage {StatusCode = HttpStatusCode.InternalServerError}; } var response = new HttpResponseMessage {StatusCode = HttpStatusCode.Created}; response.Headers.Location = new Uri(Url.Link("GetApplicationByReference", new {applicationReference = result})); return response; }