public async Task <IActionResult> PostAsync(Transfer_Provider provider) { try { _logger.LogInformation($"Adding new provider."); var checkProvider = new CheckerClass(_facilityRepository, _specialtyRepository); checkProvider.CheckProvider(provider); Inner_Provider transformedProvider = new Inner_Provider { ProviderId = 0, ProviderFirstName = provider.ProviderFirstName, ProviderLastName = provider.ProviderLastName, ProviderPhoneNumber = provider.ProviderPhoneNumber, Facility = await _facilityRepository.GetFacilityByIdAsync(provider.FacilityId), Specialty = await _specialtyRepository.GetSpecialtyByIdAsync(provider.FacilityId) }; await _providerRepository.AddProviderAsync(transformedProvider); return(CreatedAtAction(nameof(GetByIdAsync), new { id = provider.ProviderId }, provider)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }