public HttpResponseMessage Post(Template template) { Check.If(template).IsNotNull(); var result = _templateService.CreateTemplate(Mapper.Map<Core.Objects.Template>(template)); if (result == null) { return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; } var response = new HttpResponseMessage { StatusCode = HttpStatusCode.Created }; response.Headers.Location = new Uri(Url.Link("GetTemplate", new { templateReference = result })); return response; }
public HttpResponseMessage Put(string templateReference, Template template) { Check.If(templateReference).IsNotNullOrEmpty(); Check.If(template).IsNotNull(); var result = _templateService.UpdateTemplate(templateReference, Mapper.Map<Core.Objects.Template>(template)); return result ? new HttpResponseMessage { StatusCode = HttpStatusCode.OK } : new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; }