コード例 #1
0
        public static BetToDisplayGvVM ToBetToDisplayGvVM(DbBet dbBet)
        {
            var betToDisplayVM = new BetToDisplayGvVM();
            var matchResult    = MatchConverter.ToMatchResultResponse(dbBet.OriginalMatchResultString);

            betToDisplayVM.IsAssociatedWithArbitraryData = dbBet.MatchId != null;

            betToDisplayVM.Id                  = dbBet.Id;
            betToDisplayVM.BetResult           = (dbBet.BetResult ?? dbBet.OriginalBetResult).ToEnum <BetResult>();
            betToDisplayVM.IsBetResultOriginal = dbBet.BetResult == null;
            betToDisplayVM.Odds                = dbBet.Odds;

            betToDisplayVM.TipsterName    = dbBet.Tipster?.Name;
            betToDisplayVM.TipsterWebsite = dbBet.Tipster?.Link?.UrlToDomain();

            betToDisplayVM.MatchHomeName           = dbBet.Match?.Home?.Name ?? dbBet.OriginalHomeName;
            betToDisplayVM.IsMatchHomeNameOriginal = dbBet.Match?.Home?.Name == null;
            betToDisplayVM.MatchAwayName           = dbBet.Match?.Away?.Name ?? dbBet.OriginalAwayName;
            betToDisplayVM.IsMatchAwayNameOriginal = dbBet.Match?.Away?.Name == null;
            betToDisplayVM.SetUnparsedMatchString(dbBet.OriginalHomeName, dbBet.OriginalAwayName);
            betToDisplayVM.MatchHomeScore           = dbBet.Match?.HomeScore ?? matchResult.HomeScore;
            betToDisplayVM.IsMatchHomeScoreOriginal = dbBet.Match?.HomeScore == null;
            betToDisplayVM.MatchAwayScore           = dbBet.Match?.AwayScore ?? matchResult.AwayScore;
            betToDisplayVM.IsMatchAwayScoreOriginal = dbBet.Match?.AwayScore == null;
            betToDisplayVM.LocalTimestamp           = (dbBet.Match?.Date ?? dbBet.OriginalDate).ToExtendedTime().ToLocal();
            betToDisplayVM.IsLocalTimestampOriginal = dbBet.Match?.Date == null;
            betToDisplayVM.Discipline           = dbBet.Match?.League?.Discipline?.Name.ToEnum <DisciplineType>() ?? dbBet.OriginalDiscipline?.ToEnum <DisciplineType>();
            betToDisplayVM.IsDisciplineOriginal = dbBet.Match?.League?.Discipline == null;
            betToDisplayVM.LeagueName           = dbBet.Match?.League?.Name ?? dbBet.OriginalLeagueName;
            betToDisplayVM.IsLeagueNameOriginal = dbBet.Match?.League == null;

            betToDisplayVM.PickChoice = dbBet.Pick.Choice.ToEnum <PickChoice>();
            betToDisplayVM.PickValue  = dbBet.Pick.Value;
            betToDisplayVM.SetUnparsedPickString(dbBet.OriginalPickString);

            betToDisplayVM.MatchId = dbBet.MatchId;
            betToDisplayVM.TriedAssociateWithMatch = dbBet.TriedAssociateWithMatch != null && dbBet.TriedAssociateWithMatch >= 1;

            return(betToDisplayVM);
        }
コード例 #2
0
        public static BetToDisplayGvVM CopyBetToDisplayGvVM(BetToDisplayGvVM oldBetToDisplayGvVM)
        {
            var betToDisplayVM = new BetToDisplayGvVM();

            betToDisplayVM.IsAssociatedWithArbitraryData = oldBetToDisplayGvVM.IsAssociatedWithArbitraryData;

            betToDisplayVM.Id                      = oldBetToDisplayGvVM.Id;
            betToDisplayVM.BetResult               = oldBetToDisplayGvVM.BetResult;
            betToDisplayVM.IsBetResultOriginal     = oldBetToDisplayGvVM.IsBetResultOriginal;
            betToDisplayVM.Odds                    = oldBetToDisplayGvVM.Odds;
            betToDisplayVM.TipsterName             = oldBetToDisplayGvVM.TipsterName;
            betToDisplayVM.TipsterWebsite          = oldBetToDisplayGvVM.TipsterWebsite;
            betToDisplayVM.MatchHomeName           = oldBetToDisplayGvVM.MatchHomeName;
            betToDisplayVM.IsMatchHomeNameOriginal = oldBetToDisplayGvVM.IsMatchHomeNameOriginal;
            betToDisplayVM.MatchAwayName           = oldBetToDisplayGvVM.MatchAwayName;
            betToDisplayVM.IsMatchAwayNameOriginal = oldBetToDisplayGvVM.IsMatchAwayNameOriginal;
            var teamSeparator       = " - ";
            var unparsedMatchString = oldBetToDisplayGvVM.GetUnparsedMatchString();

            betToDisplayVM.SetUnparsedMatchString(unparsedMatchString.BeforeFirst(teamSeparator), unparsedMatchString.AfterFirst(teamSeparator));
            betToDisplayVM.MatchHomeScore           = oldBetToDisplayGvVM.MatchHomeScore;
            betToDisplayVM.IsMatchHomeScoreOriginal = oldBetToDisplayGvVM.IsMatchHomeScoreOriginal;
            betToDisplayVM.MatchAwayScore           = oldBetToDisplayGvVM.MatchAwayScore;
            betToDisplayVM.IsMatchAwayScoreOriginal = oldBetToDisplayGvVM.IsMatchAwayScoreOriginal;
            betToDisplayVM.LocalTimestamp           = oldBetToDisplayGvVM.LocalTimestamp;
            betToDisplayVM.IsLocalTimestampOriginal = oldBetToDisplayGvVM.IsLocalTimestampOriginal;
            betToDisplayVM.Discipline           = oldBetToDisplayGvVM.Discipline;
            betToDisplayVM.IsDisciplineOriginal = oldBetToDisplayGvVM.IsDisciplineOriginal;
            betToDisplayVM.LeagueName           = oldBetToDisplayGvVM.LeagueName;
            betToDisplayVM.IsLeagueNameOriginal = oldBetToDisplayGvVM.IsLeagueNameOriginal;

            betToDisplayVM.PickChoice = oldBetToDisplayGvVM.PickChoice;
            betToDisplayVM.PickValue  = oldBetToDisplayGvVM.PickValue;
            betToDisplayVM.SetUnparsedPickString(oldBetToDisplayGvVM.GetUnparsedPickString());
            betToDisplayVM.MatchId = oldBetToDisplayGvVM.MatchId;

            betToDisplayVM.TriedAssociateWithMatch = oldBetToDisplayGvVM.TriedAssociateWithMatch;

            return(betToDisplayVM);
        }