Esempio n. 1
0
        public ActionResult Friends(int accountID = 0)
        {
            Account account = userSession.CurrentUser;

            accountID = account.accountID;
            var friends = friendDAO.FetchFriendsAccountByAccountID(accountID);

            BeautySNS.Admin.Models.Accounts.IndexViewModel model = new BeautySNS.Admin.Models.Accounts.IndexViewModel(friends);

            model.userSession       = userSession.LoggedIn;
            model.fullName          = string.Format("{0} {1}", account.firstName, account.lastName);
            model.loggedInAccountID = account.accountID;
            model.loggedInAccount   = account;
            //model.adminUser = false;
            return(View(model));
        }
Esempio n. 2
0
        //admin view of a user's network
        public ActionResult UserNetwork(int id = 0)
        {
            //prevents users from accessing the page if they are not logged in
            if (userSession.LoggedIn == false)
            {
                return(Content("You are not logged in ! Please login to view this page"));
            }

            //prevents access to non admin users
            Account account   = userSession.CurrentUser;
            var     adminUser = accountPermissionDAO.FetchByEmail(account.email);

            if (adminUser == null)
            {
                return(Content("This page is restricted to admin users."));
            }

            //returns error message if user does not exist
            Account _account = accountDAO.FetchById(id);

            if (_account == null)
            {
                TempData["errorMessage"] = "This user does not exist";
                return(RedirectToAction("SiteActivity", "Alert"));
            }
            var friends = friendDAO.FetchFriendsAccountByAccountID(id);

            BeautySNS.Admin.Models.Accounts.IndexViewModel model = new BeautySNS.Admin.Models.Accounts.IndexViewModel(friends);

            model.adminUser         = true;
            model.userSession       = userSession.LoggedIn;
            model.loggedInAccount   = account;
            model.userSession       = userSession.LoggedIn;
            model.loggedInAccountID = account.accountID;
            model.permissionType    = adminUser.Permission.name;
            model.firstName         = _account.firstName;
            model.userAccountID     = _account.accountID;
            return(View(model));
        }