public async Task <IActionResult> ExperienceDetails(int id) { var experience = _ExperienceService.GetExperienceWithCategoriesById(id); if (experience == null) { return(NotFound()); } var categoriesOfExperience = experience.ExperienceCategoryJunctions.Select(s => s.Category).ToList(); var locationOfExperience = new Location(); var commentsOfExperience = _CommentService.GetAll().Where(i => i.ExperienceId == id).OrderByDescending(x => x.CommentId).ToList(); var user = await _UserManager.FindByNameAsync(experience.Author); var model = new ExperienceCreateUpdateModel() { ExperienceId = experience.ExperienceId, Name = experience.Name, Title = experience.Title, Author = experience.Author, Body = experience.Body, ImageUrl = experience.ImageUrl, CategoriesOfThisListing = categoriesOfExperience, CommentsOfThisListing = commentsOfExperience, AllCategories = _CategoryService.GetAll(), CreationDate = experience.DateOfCreation, AuthorProfilePicUrl = user.ProfilePicUrl }; if (experience.LocationId != null) { model.LocationOfExperience = locationOfExperience = _LocationService.GetById((int)experience.LocationId); } ; return(View(model)); }