public async Task <IActionResult> AddProvider(ProviderAC providerAC) { string userId = HttpContext.User.Claims.FirstOrDefault(c => c.Type == "user_id").Value; string fullname = HttpContext.User.Claims.FirstOrDefault(c => c.Type == "fullname").Value; return(Ok(await _iProviderRepository.AddProvider(Convert.ToInt64(userId), providerAC, fullname))); }
private async Task <ProviderDoc> FetchOrCreateProvider(ProviderCreatingDto newProvider) { var np = AutoMapper.Mapper.Map <ProviderDoc>(newProvider); var provider = await _providerRepository.Find(np); if (provider == null) { await _providerRepository.AddProvider(np); provider = np; } return(provider); }