public static Match ToMatch(this PlayerMatch source) { var match = new Match(); match.ID = source.ID; match.EventID = source.EventID; match.LocationID = source.LocationID; match.Date = source.Date; match.WinnerID = source.Result == "W" ? source.PlayerID : source.OpponentID; match.LoserID = source.Result == "L" ? source.PlayerID : source.OpponentID; ; match.Score.Sets.AddRange(source.Score.Sets); match.Defaulted = source.Defaulted; match.Comments = source.Comments; //playerMatch.EventName = match.ev //TennisEvent TennisEvent = Match.Events.Find(Match.EventID); //TennisEvent TennisEvent = TennisEvent.Get(Match.EventID); //playerMatch.EventName = TennisEvent.Name; //playerMatch.ClassID = TennisEvent.ClassificationID; //playerMatch.ClassName = ""; //playerMatch.OpponentName = Player.Get(_OpponentID).FullName; return match; }
public static Match ToMatch(this MatchRaw source) { var match = new Match(); match.ID = source.ID; match.EventID = source.EventID; match.Date = source.Date; match.WinnerID = source.WinnerID; match.LoserID = source.LoserID; match.Defaulted = source.Defaulted; match.AddSet(source.WinnerSet1, source.LoserSet1, source.WinnerTiebreak1, source.LoserTiebreak1); match.AddSet(source.WinnerSet2, source.LoserSet2, source.WinnerTiebreak2, source.LoserTiebreak2); match.AddSet(source.WinnerSet3, source.LoserSet3, source.WinnerTiebreak3, source.LoserTiebreak3); match.AddSet(source.WinnerSet4, source.LoserSet4, source.WinnerTiebreak4, source.LoserTiebreak4); match.AddSet(source.WinnerSet5, source.LoserSet5, source.WinnerTiebreak5, source.LoserTiebreak5); return match; }