Ejemplo n.º 1
0
        public IActionResult Profile()
        {
            string userId = _userService.GetCurrentUser(User.Identity.Name).Id;

            ViewData["CountOfMessages"] = _postService.GetAllPost().Where(p => p.UserId == userId).Count();
            List <PrivateMessageViewModel> messages = _messageService.GetAllMessages()
                                                      .OrderByDescending(pm => pm.Created.Date)
                                                      .ThenByDescending(pm => pm.Created.TimeOfDay)
                                                      .ToList();

            ViewBag.PrivateMessages = messages;
            ViewBag.Users           = _userService.GetAllUsers().ToList();

            UserViewModel user = _userService.GetCurrentUser(User.Identity.Name);

            return(View(user));
        }