Ejemplo n.º 1
0
        public async Task <IViewComponentResult> InvokeAsync(IModelRepository _repository)
        {
            try
            {
                var events = await _repository.Events();

                var current = events.FirstOrDefault(e => e.IsNext);
                ViewData["UserIsRegistered"] = UserIsRegistered();
                return(View(current));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to retrieve events: {ex.Message}");
                return(View(new Event()));
            }
        }