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)); }
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()); }