private void AddDataAlreadyExistsProblem(CompanyRoleInputDto companyRole) { _problemCollector.AddProblem(new CodedProblemDetails ( ProblemType.ERROR_DATA_ALREADY_EXISTS, $"{nameof(CompanyRole)}.{nameof(CompanyRole.RoleName)}", companyRole.RoleName )); }
public async Task <ActionResult> CreateAsync([FromBody] CompanyRoleInputDto companyRoleInput) { var companyRole = Mapper.Map <CompanyRole>(companyRoleInput); await CustomerLogic.CreateCompanyRoleAsync(companyRole); var errorResult = CheckProblems(); if (errorResult != null) { return(errorResult); } return(CreatedAtAction( Url.Action(nameof(GetAsync)), new { id = companyRole.Id }, companyRole)); }