Esempio n. 1
0
        public ActionResult Rate(string userName)
        {
            var loggedInUser = _sessionHelper.Get("CurrentUser") as User;

            if (loggedInUser == null)
            {
                return(RedirectToAction("Login", "Login"));
            }

            var userToRate = _userManager.GetByUserName(userName);

            if (userToRate == null)
            {
                return(HttpNotFound());
            }

            UserRatingViewModel viewModel = new UserRatingViewModel
            {
                Ratings    = _ratingManager.GetAll(),
                UserRating = new UserRating
                {
                    UserBeingRatedID = userToRate.ID,
                    UserBeingRated   = userToRate,
                    RaterUserID      = loggedInUser.ID
                }
            };

            return(View(nameof(Rate), viewModel));
        }