public ActionResult Schedule(int pageIndex, int pageSize, EventAddress eventAddress, string userName)
        {
            var scheduleUser = userService.GetUser(userName);

            if (scheduleUser == null)
            {
                // No user found
                return(null);
            }

            var userID = scheduleUser.ID;

            var user = context.User != null?context.User.Cast <UserAuthenticated>() : null;

            var userScheduleIsPublic = userScheduleService.IsUserSchedulePublic(userID);
            var showSchedule         = user != null
                                   ? context.User.Name.Equals(userName)
                                         ? true
                                         : userScheduleIsPublic
                                   : userScheduleIsPublic;

            var scheduleItems = showSchedule
                                    ? scheduleItemService.GetScheduleItemsByUser(pageIndex,
                                                                                 pageSize,
                                                                                 eventAddress,
                                                                                 userID)
                                    : new PageOfItems <ScheduleItem>(new List <ScheduleItem>(0), 0, 0, 0);

            ViewData["UserDisplayName"]      = scheduleUser.DisplayName;
            ViewData["UserScheduleIsPublic"] = userScheduleIsPublic;

            return(View(new OxiteViewModelItems <ScheduleItem>(scheduleItems)));
        }
Exemple #2
0
        private void SetUserScheduleStatus()
        {
            var user = context.User.Cast <UserAuthenticated>();

            if (user != null)
            {
                ViewData["UserScheduleIsPublic"] = userScheduleService.IsUserSchedulePublic(user.ID);
            }
        }