Ejemplo n.º 1
0
        private async Task <RoundSelectorComponentModel> FillModelWithRound(RoundSelectorComponentModel model)
        {
            try
            {
                model.RoundWithTypeList =
                    (await _appDb.RoundRepository.GetRoundsWithTypeAsync(new PredicateExpression(RoundFields.TournamentId == model.TournamentId), CancellationToken.None)).OrderBy(l => l.RoundType.Name).ThenBy(l => l.Name).ToList();

                return(model);
            }
            catch (Exception e)
            {
                _logger.LogCritical(e, $"Error creating view model for component '{nameof(RoundSelector)}'");
                return(null);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates the model for the component and renders it.
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public async Task <IViewComponentResult> InvokeAsync(RoundSelectorComponentModel model)
 {
     return(View(await FillModelWithRound(model)));
 }