Exemple #1
0
 public static IEnumerable <TeamMemberViewModel> Players(this TeamViewModel team)
 {
     return(team.Members?.Where(x => x.Role == MemberRole.Player));
 }
Exemple #2
0
 public static bool HasSelectedPlayer(this TeamViewModel team, int id)
 {
     return(team.SelectedPlayerIds.Any(x => x == id));
 }
Exemple #3
0
 public static bool HasPlayer(this TeamViewModel team, int id)
 {
     return(team.Players().Any(x => x.Id == id));
 }
Exemple #4
0
 public static TeamMemberViewModel Manager(this TeamViewModel team)
 {
     return(team.Members?.FirstOrDefault(x => x.Role == MemberRole.Manager));
 }
Exemple #5
0
 public static string ImageUrlOrNoTeam(this TeamViewModel team, UrlHelper urlHelper)
 {
     return(urlHelper.Content(team.ImageUrl ?? "~/content/img/teams/no-team.png"));
 }
Exemple #6
0
 public static string ImageUrlOrDefault(this TeamViewModel team, UrlHelper urlHelper)
 {
     return(urlHelper.Content(team.ImageUrl ?? $"~/content/img/teams/{team.Name.ToLower().Replace(" ", "-")}.png"));
 }