public async Task <IActionResult> AddCompanyAsync(CompanyCreateDto com) { if (!ModelState.IsValid) { return(BadRequest("Fill all fields")); } var company = _mapper.Map <Company>(com); try { company = await _companiesService.CreateAsync(company); return(Created(Request.Path, company.Id)); } catch (EntityPresentException e) { return(BadRequest(e.Message)); } catch { return(this.ServerError("Failed to create company")); } }