示例#1
0
        public ActionResult List()
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }
            User myUser = GetUserInformaton();
            LoggedInListModel<Fan> myLoggedInModel = new LoggedInListModel<Fan>(myUser, SiteSection.Friend);
            try {
                myLoggedInModel.Models = theFanService.GetAllFansForUser(myUser);
            } catch (Exception e) {
                LogError(e, FAN_LIST_ERROR);
                return SendToErrorPage(FAN_LIST_ERROR);
            }

            return View(LIST_VIEW, myLoggedInModel);
        }
        public ActionResult List()
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            try {
                UserInformationModel<User> myUserInfo = GetUserInformatonModel();
                LoggedInListModel<NotificationModel> myLoggedInModel = new LoggedInListModel<NotificationModel>(myUserInfo.Details);
                IEnumerable<NotificationModel> myNotifications = theNotificationService.GetNotificationsForUser(GetUserInformatonModel().Details, 50);
                myLoggedInModel.Set(myNotifications);
                return View("List", myLoggedInModel);
            } catch (Exception myException) {
                LogError(myException, NOTIFICAITON_LOAD_ERROR);
                TempData["Message"] += MessageHelper.ErrorMessage(NOTIFICAITON_LOAD_ERROR);
                return RedirectToProfile();
            }
        }
        public ActionResult Edit()
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            try {
                UserInformationModel<User> myUserInformation = GetUserInformatonModel();
                IEnumerable<Pair<Feature, bool>> myFeatures = theFeatureService.GetFeatureSettingsForUser(myUserInformation);
                LoggedInListModel<Pair<Feature, bool>> myLoggedInModel = new LoggedInListModel<Pair<Feature, bool>>(myUserInformation.Details);
                myLoggedInModel.Set(myFeatures);
                return View("Edit", myLoggedInModel);
            } catch (Exception myException) {
                LogError(myException, FEATURE_RETRIEVAL_ERROR);
                TempData["Message"] += MessageHelper.ErrorMessage(FEATURE_RETRIEVAL_ERROR);
            }

            return RedirectToProfile();
        }
        public ActionResult List()
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            User myUser = GetUserInformatonModel().Details;
            LoggedInListModel<NotificationModel> myModel = new LoggedInListModel<NotificationModel>(myUser, SiteSection.Notification);
            try {
                myModel.Models = theNotificationService.GetNotifications(myUser);

                if (myModel.Models.Count<NotificationModel>() == 0) {
                    ViewData["Message"] = MessageHelper.NormalMessage(NO_NOTIFICAITONS);
                }
            } catch (Exception myException) {
                LogError(myException, NOTIFICATION_ERROR);
                ViewData["Message"] = MessageHelper.ErrorMessage(NOTIFICATION_ERROR);
            }

            return View(LIST_VIEW, myModel);
        }
        public ActionResult List()
        {
            try {
                UserInformationModel<User> myUserInfo = GetUserInformatonModel();
                string myUniversity = UniversityHelper.GetMainUniversity(myUserInfo.Details).Id;
                LoggedInListModel<UserStatus> myLoggedInModel = new LoggedInListModel<UserStatus>(myUserInfo.Details);
                IEnumerable<UserStatus> myUserStatuses = theUserStatusService.GetLatestUserStatusesWithinUniversity(myUserInfo, myUniversity, 30);
                myLoggedInModel.Set(myUserStatuses);

                return View("List", myLoggedInModel);
            } catch (Exception e) {
                LogError(e, LIST_ERROR);
                TempData["Message"] += ErrorMessage(LIST_ERROR);
            }

            return RedirectToHomePage();
        }
        public ActionResult List(UpdateUserProfileQuestionsModel aSettings)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            UserInformationModel<User> myUser = GetUserInformatonModel();
            LoggedInListModel<FriendConnectionModel> myLoggedIn = new LoggedInListModel<FriendConnectionModel>(myUser.Details, SiteSection.FriendSuggestion);
            IEnumerable<FriendConnectionModel> myConnectionModel = new List<FriendConnectionModel>();

            try {
                myConnectionModel = theProfileQuestionsService.GetPossibleFriendConnections(myUser, 3);

                if (myConnectionModel.Count<FriendConnectionModel>() == 0) {
                    TempData["Message"] += MessageHelper.NormalMessage(NO_SUGGESTIONS);
                }
            } catch (Exception e) {
                LogError(e, SUGGESTION_FAIL);
                TempData["Message"] += MessageHelper.ErrorMessage(SUGGESTION_FAIL);
            }

            myLoggedIn.Set(myConnectionModel);

            return View(LIST_VIEW, myLoggedIn);
        }