public ActionResult <SalonModel> Post(SalonModel model) { try { var uri = _linkGenerator.GetPathByAction(HttpContext, "Get", values: new { name = model.SalonName }); if (string.IsNullOrWhiteSpace(uri)) { return(BadRequest("Could not use current name")); } var salon = _repository.Create(model); if (_repository.SaveChangesAsync()) { return(Created(uri, _mapper.Map <SalonModel>(salon))); } else { return(BadRequest()); } } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, "Database Failure")); } }