예제 #1
0
        public async Task <IActionResult> Profile2(string id)
        {
            var user = await _UserManager.FindByNameAsync(id);

            var profileModel = new ProfileModel()
            {
                UserId             = user.Id,
                UserName           = user.UserName,
                FirstName          = user.FirstName,
                LastName           = user.LastName,
                FullName           = user.FirstName + user.LastName,
                Email              = user.Email,
                Age                = DateTime.Now.AddYears(-user.DateOfBirth.Year).Year,
                Hometown           = user.Hometown,
                HomeCountry        = user.HomeCountry,
                Bio                = user.Bio,
                Description        = user.Description,
                PersonalWebsite    = user.PersonalWebsite,
                InstagramId        = user.InstagramId,
                YoutubeId          = user.YoutubeId,
                CurrentCountry     = user.CurrentCountry,
                CurrentlyTraveling = user.CurrentlyTraveling,
                ProfilePicUrl      = user.ProfilePicUrl,
                VisitedCountries   = user.VisitedCountryCodesList.Split(',').OrderBy(q => q).ToList(),
                DateOfBirth        = user.DateOfBirth,

                Experiences = _ExperienceService.AllExperiencesWithCategories().Where(e => e.Author == user.UserName).ToList(),
            };

            ViewBag.MapDisplay = TransformToJsArray(user.VisitedCountryCodesList);

            return(View(profileModel));
        }