public async Task <IActionResult> EditCompany(string id, EditOrgStructureGenericDto companyDto) { if (id != companyDto.Id) { return(BadRequest()); } try { var company = new Company() { Id = companyDto.Id, Name = companyDto.Name }; await _orgStructureService.EditCompanyAsync(company); } catch (Exception ex) { _logger.LogError(ex.Message); return(StatusCode(500, new { error = ex.Message })); } return(NoContent()); }
public async Task <IActionResult> EditPosition(string id, EditOrgStructureGenericDto positionDto) { if (id != positionDto.Id) { return(BadRequest()); } try { var position = new Position() { Id = positionDto.Id, Name = positionDto.Name }; await _orgStructureService.EditPositionAsync(position); } catch (Exception ex) { _logger.LogError(ex.Message); return(StatusCode(500, new { error = ex.Message })); } return(NoContent()); }