public ActionResult Index()
        {
            UserProfileModel model = new UserProfileModel();

            model = UsersRepository.GetUserProfileModel(UserContextHelper.GetUserContextModel().ID);
            return(View("UserProfile", model));
        }
Exemple #2
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            UserContextModel user = UserContextHelper.GetUserContextModel();

            if (user == null)
            {
                var controller = new HomeController();
                filterContext.Result = controller.RedirectToAction("Index", "Home");
            }
        }
        public ActionResult ChangePassword(UserProfileModel model)
        {
            if (UsersRepository.ValidatePasswordIsCorrect(UserContextHelper.GetUserContextModel().Email,
                                                          model.OldPassword) != null)
            {
                if (UsersRepository.ChangePassword(model.NewPassword, UserContextHelper.GetUserContextModel().ID))
                {
                    ModelState.Clear();
                    ViewBag.SuccessMessages = "Zmiana hasła zakończona pomyślnie";
                }
            }

            model = UsersRepository.GetUserProfileModel(UserContextHelper.GetUserContextModel().ID);
            ViewBag.ErrorMessages = UsersRepository.ErrorList;
            return(View("UserProfile", model));
        }
        public ActionResult PreviewSportEvent(int sportEventId)
        {
            int             userIdFromContext  = UserContextHelper.GetUserContextModel().ID;
            SportEventModel model              = SportEventRepository.GetSportEventDetails(sportEventId);
            DateTime        sportEventDateTime = DateTime.Parse(model.Date + " " + model.Time);
            var             differenceHours    = (sportEventDateTime - DateTime.Now).TotalHours;

            if (differenceHours < 1)
            {
                model.ContactList = SportEventRepository.GetContactDetailsForSportEvent(sportEventId, userIdFromContext);
            }
            model.IsCreateMode = false;
            SetEnumDDisciplineSelectList(false);
            TempData["IsUserParticipating"] =
                SportEventRepository.IsUserParticipatingInSportEvent(userIdFromContext,
                                                                     sportEventId);
            return(View("SportEvent", model));
        }
        public JsonResult GetNotifications()
        {
            var notifications = UsersRepository.GetNotificationsForUser(UserContextHelper.GetUserContextModel().ID);

            return(Json(notifications));
        }
        public ActionResult Achievements()
        {
            var achievementList = UsersRepository.GetUserAchievements(UserContextHelper.GetUserContextModel().ID);

            return(View("Achievements", achievementList));
        }