예제 #1
0
        public PartialViewResult FilterUserHistory(string filterOption)
        {
            var         filterOptionSub = filterOption.Replace(" ", string.Empty);
            var         currentUserId   = User.Identity.GetUserId();
            var         userHistory     = new UserHistoryCreation(currentUserId);
            UserHistory newHistory      = new UserHistory();

            if (Enum.TryParse <UserHistoryOptionsEnum>(filterOptionSub, out var userHistoryOption))
            {
                switch (userHistoryOption)
                {
                case UserHistoryOptionsEnum.Feeds:
                    newHistory = userHistory.CreateFeedModel();
                    break;

                case UserHistoryOptionsEnum.Posts:
                    newHistory = userHistory.CreatePostModel();
                    break;

                case UserHistoryOptionsEnum.Comments:
                    newHistory = userHistory.CreateCommentModel();
                    break;

                case UserHistoryOptionsEnum.AllHistory:
                    newHistory = userHistory.CreateModel();
                    break;

                default:
                    newHistory = userHistory.CreateModel();
                    break;
                }
            }

            return(PartialView("History", newHistory));
        }
예제 #2
0
        public ActionResult UserHistory()
        {
            var currentUserId = User.Identity.GetUserId();
            var currentUser   = _userRepository.Find(u => u.Id == currentUserId).FirstOrDefault();
            var userHistory   = new UserHistoryCreation(currentUserId).CreateModel();

            userHistory.User = currentUser;
            return(View(userHistory));
        }