public ActionResult UserPanel(int userID = -1)
        {
            int requestedUser = userID > 0 ? userID : SessionManager.UserID;


            if (Authorisation.CanModifyUser(requestedUser, SessionManager.UserToken))
            {
                User user = UserRepository.GetUserByID(requestedUser);
                return(View(user));
            }
            else
            {
                return(View("Error"));
            }
        }
Esempio n. 2
0
        public ViewResult EditUser(int shownUserID)
        {
            if (Authorisation.CanModifyUser(shownUserID, SessionManager.UserToken))
            {
                User user = UserRepository.GetUserByID(shownUserID);

                if (user != null)
                {
                    UserViewModel userModel = new UserViewModel(user);
                    return(View(userModel));
                }
                else
                {
                    return(View("Error"));
                }
            }
            else
            {
                return(View("Error"));
            }
        }