public async Task <IActionResult> Details() { var doctor = await _doctorRepository.GetDoctorByUserEmail(this.User.Identity.Name); if (doctor == null || doctor.IsDeleted) { return(NotFound()); } doctor.User = await _userRepository.GetUserByEmailAsync(this.User.Identity.Name); if (doctor.User == null || doctor.User.IsDeleted) { return(NotFound()); } doctor.Room = await _specialityRepository.GetRoomByIdAsync(doctor.RoomId); if (doctor.Room == null) { return(NotFound()); } doctor.Room.Speciality = await _specialityRepository.GetSpecialityAsync(doctor.Room); if (doctor.Room.Speciality == null) { return(NotFound()); } var model = _converterHelper.ToDoctorDetailsViewModel(doctor); return(View(model)); }