Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #6
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);
        }