Exemplo n.º 1
0
        public HandInfoDataContract[] GetHandsList(string date)
        {
            var statisticCollection = storageModel.GetStatisticCollection();

            DateTime parsedDate = ParseDate(date, statisticCollection.Max(x => x.Time));

            if (TryParseDate(date, out parsedDate))
            {
                return(statisticCollection.Where(x => x.Time.Date == parsedDate.Date).Select(x => HandInfoDataContract.Map(x)).ToArray());
            }
            else
            {
                return(statisticCollection.Select(x => HandInfoDataContract.Map(x)).ToArray());
            }
        }
Exemplo n.º 2
0
        public HandInfoDataContract[] GetPlayerHandsList(string playerName, string pokerSite, string date)
        {
            EnumPokerSites site = EnumPokerSites.Unknown;

            if (!Enum.TryParse(pokerSite, out site) || site == EnumPokerSites.Unknown)
            {
                throw new WebFaultException <string>($"Cannot recognise site {pokerSite}", System.Net.HttpStatusCode.BadRequest);
            }

            var statistic = playerStatisticRepository.GetPlayerStatistic(playerName, (short)site);

            DateTime parsedDate = DateTime.Now;

            if (TryParseDate(date, out parsedDate))
            {
                return(statistic.Where(x => x.Time.Date == parsedDate.Date).Select(x => HandInfoDataContract.Map(x)).ToArray());
            }
            else
            {
                return(statistic.Select(x => HandInfoDataContract.Map(x)).ToArray());
            }
        }