-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adrian Fürschuß
committed
Nov 23, 2016
1 parent
b98df19
commit c13a9e7
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Wuzlstats.ViewModels.Teams | ||
{ | ||
public class IndexViewModel | ||
{ | ||
public string ActiveFilter { get; set; } | ||
public bool Recent { get; set; } | ||
public int Days { get; set; } | ||
public IEnumerable<TeamViewModel> Teams { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace Wuzlstats.ViewModels.Teams | ||
{ | ||
public class PlayerViewModel | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } | ||
public string Image { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
|
||
namespace Wuzlstats.ViewModels.Teams | ||
{ | ||
public class TeamViewModel | ||
{ | ||
public PlayerViewModel Player1 { get; set; } | ||
public PlayerViewModel Player2 { get; set; } | ||
public int Wins { get; set; } | ||
public int Losses { get; set; } | ||
public DateTime LastGamePlayedOn { get; set; } | ||
public int GamesCount { get; set; } | ||
|
||
// ReSharper disable once PossibleLossOfFraction | ||
public double Rank => Losses == 0 ? Wins : (Wins == 0 ? 0.1d / Losses : (double)Wins / Losses); | ||
|
||
public bool Equals(PlayerViewModel p1, PlayerViewModel p2) | ||
{ | ||
if (Player1 == null || Player2 == null) | ||
{ | ||
return false; | ||
} | ||
if (p1.Id <= p2.Id) | ||
{ | ||
return Player1.Id == p1.Id && Player2.Id == p2.Id; | ||
} | ||
return Player2.Id == p1.Id && Player1.Id == p2.Id; | ||
} | ||
} | ||
} |