Ejemplo n.º 1
0
        public TeamSearch Get(TeamSearchFilterOptions filterOptions)
        {
            var teamFilterOptions = QueryFilterService.BuildTeamFilterOptions(filterOptions);

            var teamsData = _teamQueryService.Execute(teamFilterOptions);

            var teams = teamsData
                        .Select(x => new Team
            {
                Id       = x.Id,
                Name     = string.Format("{0} {1}", x.City, x.Nickname),
                City     = x.City,
                Nickname = x.Nickname,
                League   = x.League != null ? new League {
                    Id = x.Id, Name = x.League.Name
                } : null,
                Sport = x.Sport != null ? new Sport {
                    Id = x.Sport.Id, Name = x.Sport.Name
                } : null,
                College = x.College != null ? new College {
                    Id = x.College.Id, Name = x.College.Name
                } : null
            })
                        .ToList();

            var teamSearch = new TeamSearch
            {
                FilterOptions = filterOptions,
                Teams         = teams
            };

            return(teamSearch);
        }
Ejemplo n.º 2
0
        public List <College> GetColleges(MagazineSearchFilterOptions filterOptions)
        {
            var collectibleFilterOptions = QueryFilterService.BuildCollectibleFilterOptions(filterOptions);
            var collegesData             = _collectibleQueryService.SelectColleges(collectibleFilterOptions);

            var colleges = collegesData
                           .Select(x => new College
            {
                Id   = x.Id,
                Name = string.Format("{0} {1}", x.Name ?? "", x.Nickname ?? "")
            })
                           .ToList();

            return(colleges);
        }
Ejemplo n.º 3
0
        public List <Grader> GetGraders(CardSearchFilterOptions filterOptions)
        {
            var collectibleFilterOptions = QueryFilterService.BuildCollectibleFilterOptions(filterOptions);

            var gradersData = _collectibleQueryService.SelectGraders(collectibleFilterOptions);

            var graders = gradersData
                          .Select(x => new Grader
            {
                Id   = x.Id,
                Name = x.Organization.Name
            })
                          .ToList();

            return(graders);
        }
Ejemplo n.º 4
0
        public List <Person> GetPeople(MagazineSearchFilterOptions filterOptions)
        {
            var collectibleFilterOptions = QueryFilterService.BuildCollectibleFilterOptions(filterOptions);
            var peopleData = _collectibleQueryService.SelectPeople(collectibleFilterOptions);

            var people = peopleData
                         .OrderBy(x => x.LastName)
                         .Select(x => new Person
            {
                Id   = x.Id,
                Name = string.Format("{0} {1}", x.FirstName, x.LastName)
            })
                         .ToList();

            return(people);
        }
Ejemplo n.º 5
0
        public PersonSearch Get(PersonSearchFilterOptions filterOptions)
        {
            var personFilterOptions = QueryFilterService.BuildPersonFilterOptions(filterOptions);

            var peopleData = _personQueryService.Execute(personFilterOptions);
            var sportsData = SportCodeService.Select();

            var people = peopleData
                         .Select(x => new Person
            {
                Id         = x.Id,
                Identifier = x.Identifier,
                Name       = String.Format("{0} {1}", x.FirstName ?? "", x.LastName),
                LastName   = x.LastName,
                FirstName  = x.FirstName,
                MiddleName = x.MiddleName,
                Suffix     = x.Suffix,
                College    = x.College != null ? new College
                {
                    Id         = x.College.Id,
                    Identifier = x.College.Identifier,
                    Name       = x.College.Name,
                    Nickname   = x.College.Nickname
                } : null,
                Sports = x.PersonSports.Select(ps => new Sport
                {
                    Id         = ps.SportId,
                    Identifier = sportsData.Single(s => s.Id == ps.SportId).Identifier,
                    Name       = sportsData.Single(s => s.Id == ps.SportId).Name
                }).ToList(),
                HOFFlag     = x.HOFFlag == true,
                HeismanFlag = x.HeismanFlag == true,
                NotableFlag = x.NotableFlag == true
            })
                         .ToList();

            var personSearch = new PersonSearch
            {
                PersonFilterOptions = filterOptions,
                People = people
            };

            return(personSearch);
        }
Ejemplo n.º 6
0
        public List <Team> GetTeams(MagazineSearchFilterOptions filterOptions)
        {
            var collectibleFilterOptions = QueryFilterService.BuildCollectibleFilterOptions(filterOptions);
            var teamsData = _collectibleQueryService.SelectTeams(collectibleFilterOptions);

            var teams = teamsData
                        .OrderBy(x => x.City)
                        .Select(x => new Team
            {
                Id     = x.Id,
                Name   = string.Format("{0} {1}", x.City, x.Nickname),
                League = x.League != null ? new League {
                    Id = x.League.Id, Name = x.League.Name
                } : null
            })
                        .ToList();

            return(teams);
        }
        public FigurineSearch Get(FigurineSearchFilterOptions filterOptions)
        {
            var collectibleFilterOptions = QueryFilterService.BuildCollectibleFilterOptions(filterOptions);

            var collectiblesData = _collectibleQueryService.SelectCollectibles(collectibleFilterOptions);

            var figurines = collectiblesData
                            .Select(x => new Figurine
            {
                Id          = x.Id,
                Identifier  = x.Id.ToString(),
                Title       = string.Format("{0} {1} #{2} {3}{4}", x.Year, x.Set.Name, x.CardNumber, x.Person != null ? string.Format("{0} {1}", x.Person.FirstName, x.Person.LastName) : string.Format("{0} {1}", x.ImportCollectible.FirstName, x.ImportCollectible.LastName), x.RCFlag == true ? " (RC)" : ""),
                Year        = x.Year,
                CompanyName = x.Set.Name,
                PersonName  = x.Person != null ? string.Format("{0} {1}", x.Person.FirstName, x.Person.LastName) : string.Format("{0} {1}", x.ImportCollectible.FirstName, x.ImportCollectible.LastName),
                Number      = x.CardNumber,
                SportName   = x.Sport != null ? x.Sport.Name : null,
                LeagueName  = x.League != null ? x.League.Name : (x.Team != null && x.Team.League != null) ? x.Team.League.Name : "",
                TeamName    = x.Team != null ? string.Format("{0} {1}", x.Team.City, x.Team.Nickname) : "",
                Description = x.ImportCollectible.Description,
                HOF         = x.Person != null ? x.Person.HOFFlag == true ? "HOF" : "" : "",
                PersonId    = x.Person != null ? x.Person.Id : 0,
                TeamId      = x.Team != null ? x.Team.Id : 0,
                Cost        = x.Cost ?? 0,
                Value       = x.Value ?? 0
            })
                            .ToList();

            var figurinesSearch = new FigurineSearch
            {
                FilterOptions   = filterOptions,
                Figurines       = figurines,
                NumCollectibles = figurines.Count,
                TotalCost       = figurines.Sum(x => x.Cost),
                TotalValue      = figurines.Sum(x => x.Value)
            };

            return(figurinesSearch);
        }
Ejemplo n.º 8
0
        public CardSearch Get(CardSearchFilterOptions filterOptions)
        {
            var collectibleFilterOptions = QueryFilterService.BuildCollectibleFilterOptions(filterOptions);

            var collectiblesData = _collectibleQueryService.SelectCollectibles(collectibleFilterOptions);

            var cards = collectiblesData
                        .Select(x => new Card
            {
                Id         = x.Id,
                Identifier = x.Id.ToString(),
                Title      = string.Format("{0} {1} #{2} {3}{4}", x.Year, x.Set.Name, x.CardNumber, x.Person != null ? string.Format("{0} {1}", x.Person.FirstName, x.Person.LastName) : string.Format("{0} {1}", x.ImportCollectible.FirstName, x.ImportCollectible.LastName), x.RCFlag == true ? " (RC)" : ""),
                Year       = x.Year,
                SetName    = x.Set.Name,
                Person     = x.Person == null ? null : new Person
                {
                    Id         = x.Person.Id,
                    Identifier = x.Person.Identifier,
                    FirstName  = x.Person.FirstName,
                    LastName   = x.Person.LastName,
                    MiddleName = x.Person.MiddleName,
                    Suffix     = x.Person.Suffix,
                    HOFFlag    = x.Person.HOFFlag == true ? true : false
                },
                CardNumber = x.CardNumber,
                CardType   = x.CardType == null ? null : new CardType
                {
                    Id         = x.CardType.Id,
                    Identifier = x.CardType.Identifier,
                    Name       = x.CardType.Name
                },
                Sport = x.Sport == null ? null : new Sport
                {
                    Id   = x.Sport.Id,
                    Name = x.Sport.Name
                },
                League = x.League == null ? null : new League
                {
                    Id   = x.League.Id,
                    Name = x.League.Name
                },
                Team = x.Team == null ? null : new Team
                {
                    Id         = x.Team.Id,
                    Identifier = x.Team.Identifier,
                    City       = x.Team.City,
                    Nickname   = x.Team.Nickname
                },
                Grade = x.Grade == null ? null : new Grade
                {
                    Id         = x.Grade.Id,
                    Identifier = x.Grade.Identifier,
                    Name       = x.Grade.Name,
                    GraderName = x.Grade.Grader != null ? x.Grade.Grader.Organization.Name : "??"
                },
                Condition  = x.GradedFlag ? "" : x.Condition,
                RCFlag     = x.RCFlag,
                AUFlag     = x.AUFlag,
                PatchFlag  = x.PatchFlag,
                GradedFlag = x.GradedFlag,
                SPFlag     = x.SPFlag,
                Cost       = x.Cost ?? 0,
                Value      = x.Value ?? 0
            })
                        .ToList();

            var cardSearch = new CardSearch
            {
                FilterOptions = filterOptions,
                Cards         = cards,
                NumCards      = cards.Count,
                TotalCost     = cards.Sum(x => x.Cost ?? 0),
                TotalValue    = cards.Sum(x => x.Value ?? 0)
            };

            return(cardSearch);
        }