Exemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            var currentEvents = _eventService.GetEventTypes().Where(x => x.Active);

            if (_authContext.User != null)
            {
                var tokens = new List <SelectListItem>();
                foreach (var item in _tokenService.GetGrantedTokensByUserId(_authContext.User.User.Id))
                {
                    tokens.Add(new SelectListItem {
                        Text  = item.UniqueToken,
                        Value = item.UniqueToken
                    });
                }
                return(await Task.Run(() => View(new VideoUploadViewModel
                {
                    EventTypes = currentEvents.ToList(),
                    UserTokens = tokens,
                    MaskingTypes = _tokenService.GetMaskingType()
                })));
            }
            return(await Task.Run(() => View(new VideoUploadViewModel
            {
                EventTypes = currentEvents.ToList(),
                UserTokens = new List <SelectListItem>(),
            })));
        }