示例#1
0
 public IActionResult Index(int id = 0, string date = "")
 {
     ViewBag.id               = id;
     ViewBag.date             = date;
     ViewBag.SeasonIdList     = _repository.GetSeasonIds();
     ViewBag.ListOfMatchDates = _repository.GetListOfMatchDatesPerSeason();
     if (User.Claims != null)
     {
         return(View(new MatchesViewModel()
         {
             Matches = _repository.GetMatches(),
             UserRole =
                 _repository.GetUserRole(
                     User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value.Substring(6))
         }));
     }
     return(View(new MatchesViewModel()
     {
         Matches = _repository.GetMatches(),
         UserRole = 0
     }));
 }