public async Task <IActionResult> Details() { var client = await _clientRepository.GetClientByUserEmail(this.User.Identity.Name); if (client == null || client.IsDeleted) { return(NotFound()); } client.User = await _userRepository.GetUserByEmailAsync(this.User.Identity.Name); if (client.User == null || client.User.IsDeleted) { return(NotFound()); } if (client.InsuranceCompanyId != null) { client.InsuranceCompany = await _insuranceCompanyRepository.GetByIdAsync(client.InsuranceCompanyId.Value); } else { client.InsuranceCompany = new InsuranceCompany(); } client.Animals = _animalRepository.GetClientAnimals(client.Id).ToList(); var model = _converterHelper.ToClientDetailsViewModel(client); return(View(model)); }
public async Task <IActionResult> Details(int?id) { if (id == null) { return(this.NotFound()); } var insurance = await _insuranceCompanyRepository.GetByIdAsync(id.Value); if (insurance == null) { return(this.NotFound()); } var model = _converterHelper.ToDetailsViewModel(insurance); return(View(model)); }