public HttpResponseMessage PostCertificate(string propertyReference, Certificate certificate) { Check.If(propertyReference).IsNotNullOrEmpty(); Check.If(certificate).IsNotNull(); var result = _certificateService.CreateCertificate(propertyReference, Mapper.Map<Core.Objects.Certificate>(certificate)); if (result == null) { return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; } var response = new HttpResponseMessage { StatusCode = HttpStatusCode.Created }; response.Headers.Location = new Uri(Url.Link("GetCertificate", new { propertyReference, certificateReference = result })); return response; }
public HttpResponseMessage PutCertificate(string propertyReference, string certificateReference, Certificate certificate) { Check.If(propertyReference).IsNotNullOrEmpty(); Check.If(certificateReference).IsNotNullOrEmpty(); Check.If(certificate).IsNotNull(); var result = _certificateService.UpdateCertificate(propertyReference, certificateReference, Mapper.Map<Core.Objects.Certificate>(certificate)); return result ? new HttpResponseMessage { StatusCode = HttpStatusCode.OK } : new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; }