public async Task <IViewComponentResult> InvokeAsync(string id, bool allEventGroups = false)
        {
            var userContext = _userContextAccessor.GetContext();
            var eventGroups = new List <CalendarEventGroup>();

            //Get Event or set default
            ViewData["eventId"] = id;

            var theEvent = _calendarQueryService.GetEventById(id);

            var allMyGroups = !allEventGroups
                                ? _calendarQueryService.GetEventGroupsByUserId(userContext.UserId)
                                : _calendarQueryService.GetSharedEventGroups(_calendarSecurity.GetEventGroupsSharedWithMe(), userContext.UserId);



            //TODO add my groups or option to add all other groups
            ViewData["EventGroups"]    = allMyGroups;
            ViewData["AllEventGroups"] = allEventGroups;

            if (theEvent == null)
            {
                theEvent = new CalendarEvent();
            }
            else
            {
                foreach (var refObject in theEvent.EventGroupEvents)
                {
                    refObject.Event = null;
                }
            }


            return(View(theEvent));
        }
Exemple #2
0
        public async Task <IViewComponentResult> InvokeAsync(string calendarWidgetId, bool allEventGroups = false)
        {
            var userContext = _userContextAccessor.GetContext();

            var allGroups = !allEventGroups
                               ? _calendarQueryService.GetEventGroupsByUserId(userContext.UserId)
                               : _calendarQueryService.GetSharedEventGroups(_calendarSecurity.GetEventGroupsSharedWithMe(), userContext.UserId);

            var selectedWigetEventGroups = _calendarQueryService.GetWidgetGroups(calendarWidgetId).ToList();

            ViewData["EventGroups"] = allGroups;
            ViewData["SelectedWidgetEventGroups"] = selectedWigetEventGroups;

            ViewData["AllEventGroups"] = allEventGroups;

            ViewData["widgetId"] = calendarWidgetId;
            ViewData["siteId"]   = _siteContext.SiteId;

            return(View());
        }
Exemple #3
0
        public async Task <IViewComponentResult> InvokeAsync(string widgetId, bool shared = false)
        {
            var userContext = _userContextAccessor.GetContext();

            var viewModel = new UpcomingEventsGroupFormViewModel
            {
                WidgetId = widgetId,
                UserId   = userContext.UserId
            };

            if (!shared)
            {
                viewModel.UpcomingEventGroups = _calendarQueryService.GetEventGroupsByUserId(userContext.UserId);
            }
            else
            {
                viewModel.UpcomingEventGroups = _calendarSecurity.GetEventGroupsSharedWithUser(userContext);
            }

            viewModel.SelectedGroupIds = await GetSelectedCategories(widgetId);

            return(View(viewModel));
        }