コード例 #1
0
 public IActionResult Overview(User user)
 {
     if (HttpContext.Session.GetInt32("Id") == null)
     {
         return(RedirectToAction("Login", "Account"));
     }
     else
     {
         user.Id = (int)HttpContext.Session.GetInt32("Id");
         _userLogic.GetUserDetails(user);
         ProfilePicture   profilePicture   = _profilePictureLogic.GetProfilePicture(user);
         ProfileViewModel profileViewModel = new ProfileViewModel()
         {
             Id         = user.Id,
             Firstname  = user.Firstname,
             Middlename = user.Middlename,
             Lastname   = user.Lastname,
             Birthdate  = user.Birthdate,
             Country    = user.Country,
             City       = user.City,
             Biography  = user.Biography,
             Img        = profilePicture.Image,
         };
         profileViewModel.Posts = new List <Post>();
         profileViewModel.Posts.AddRange(_postLogic.GetPost(user));
         profileViewModel.Followers = new List <User>();
         profileViewModel.Followers.AddRange(_userLogic.GetFollowers(user));
         profileViewModel.Following = new List <User>();
         profileViewModel.Following.AddRange(_userLogic.GetFollowing(user));
         return(View(profileViewModel));
     }
 }