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