public ActionResult <CompanyModel> CreateCompany([FromBody] CompanyModel companyModel) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var url = HttpContext.Request.Host; var newCompany = _companyService.CreateCompany(companyModel); return(CreatedAtRoute("GetCompany", new { companyId = newCompany.Id }, newCompany)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, $"Something happend: {ex.Message}")); } }