public IHttpActionResult Put([FromBody] CertificateUriModel model) { if (TheRepository.GetCertificationByName(model.Name) != null) { return(Conflict()); } if (TheRepository.UpdateCertification(TheModelFactory.Convert(model)) && TheRepository.SaveAll()) { return(Created(TheModelFactory.Create(TheModelFactory.Convert(model)).Url, model)); } return(BadRequest()); }
public IHttpActionResult Post([FromBody] CertificateUriModel model) { if (TheRepository.GetCertificationByName(model.Name) != null) { // 409 error return(Conflict()); } var modelCertificate = TheModelFactory.Convert(model); if (TheRepository.InsertCertification(modelCertificate) && TheRepository.SaveAll()) { var modelUriCreated = TheModelFactory.Create(modelCertificate); return(Created(modelUriCreated.Url, modelUriCreated)); } return(BadRequest()); }