public TeamIndex Build(TeamFilterOptionsViewModel filterOptionsVM) { var teamSearchFilterOptions = SearchFilterService.BuildTeamSearchFilterOptions(filterOptionsVM); if (teamSearchFilterOptions == null) { teamSearchFilterOptions = new TeamSearchFilterOptions(); } var teamSearch = _teamSearchService.Get(teamSearchFilterOptions); var sports = _sportService.Get(); var leagues = _leagueService.Get(); var teamList = teamSearch.Teams.Select(x => new TeamListItemViewModel { Id = x.Id, Name = x.ToString(), LeagueName = x.League != null? x.League.Name : "", SportName = x.Sport != null ? x.Sport.Name : "", CollegeId = x.College != null ? x.College.Id : 0, CollegeName = x.College != null ? x.College.Name : "" }) .ToList(); var teamSearchViewModel = new TeamIndex { TeamFilterOptionsViewModel = filterOptionsVM, Teams = teamList, Sports = MvcService.BuildSportsSelectList(sports, teamSearchFilterOptions.SportId ?? 0), Leagues = MvcService.BuildLeaguesSelectList(leagues, teamSearchFilterOptions.LeagueId ?? 0) }; return(teamSearchViewModel); }
public FigurineIndex Build(FigurineFilterOptionsViewModel filterOptionsViewModel) { var figurineFilterOptions = SearchFilterService.BuildFigurineSearchFilterOptions(filterOptionsViewModel); var defaultFilterOptions = new FigurineSearchFilterOptions(); if (figurineFilterOptions == null) { figurineFilterOptions = defaultFilterOptions; } var collectibleSearch = _figurineSearchService.Get(figurineFilterOptions); var people = _figurineSearchService.GetPeople(defaultFilterOptions); var figurines = collectibleSearch.Figurines.Select(x => new FigurineListItemViewModel { Id = x.Id, Identifier = x.Identifier, PersonName = x.PersonName, PersonId = x.PersonId, CompanyName = x.CompanyName, LeagueName = x.LeagueName, TeamName = x.TeamName, TeamId = x.TeamId, SportName = x.SportName, Year = x.Year.ToString(), Number = x.Number != null ? x.Number.ToString() : "--", Cost = x.Cost, Value = x.Value }) .ToList(); var vm = new FigurineIndex { DisplayName = "Figurines", Figurines = figurines, SearchTotalsVM = new SearchTotalsViewModel { NumCollectibles = collectibleSearch.NumCollectibles, TotalCost = collectibleSearch.TotalCost, TotalValue = collectibleSearch.TotalValue }, People = MvcService.BuildPeopleSelectList(people, figurineFilterOptions.PersonId ?? 0), FilterOptions = filterOptionsViewModel }; return(vm); }
public MagazineIndex Build(MagazineFilterOptionsViewModel filterOptionsViewModel) { var magazineFilterOptions = SearchFilterService.BuildMagazineSearchFilterOptions(filterOptionsViewModel); var defaultFilterOptions = new MagazineSearchFilterOptions(); if (magazineFilterOptions == null) { magazineFilterOptions = defaultFilterOptions; } var magazineSearch = _magazineSearchService.Get(magazineFilterOptions); var people = _magazineSearchService.GetPeople(defaultFilterOptions); var magazines = magazineSearch.Magazines.Select(x => new MagazineListItemViewModel { Id = x.Id, Identifier = x.Identifier, PersonName = x.PersonName, PersonId = x.PersonId, PublisherName = x.PublisherName, LeagueName = x.LeagueName, TeamName = x.TeamName, TeamId = x.TeamId, SportName = x.SportName, Year = x.Year.ToString(), Cost = x.Cost, Value = x.Value }) .ToList(); var vm = new MagazineIndex { DisplayName = "Magazines", Magazines = magazines, SearchTotalsVM = new SearchTotalsViewModel { NumCollectibles = magazineSearch.NumCollectibles, TotalCost = magazineSearch.TotalCost, TotalValue = magazineSearch.TotalValue }, People = MvcService.BuildPeopleSelectList(people, magazineFilterOptions.PersonId ?? 0), FilterOptions = filterOptionsViewModel }; return(vm); }
public PersonIndex Build(PersonFilterOptionsViewModel filterOptionsViewModel) { var personSearchFilterOptions = SearchFilterService.BuildPersonSearchFilterOptions(filterOptionsViewModel); if (personSearchFilterOptions == null) { personSearchFilterOptions = new PersonSearchFilterOptions(); } var personSearch = _personSearchService.Get(personSearchFilterOptions); var teams = _teamService.Get(); var sports = _sportService.Get(); var leagues = _leagueService.Get(); var peopleList = personSearch.People.Select(x => new PersonListItemViewModel { Id = x.Id, Name = x.LastName == null ? string.Format("[{0}]", x.Identifier) : x.ToString(), CollegeId = x.College != null ? x.College.Id : 0, CollegeName = x.College != null ? x.College.Name : "", SportNames = x.Sports != null ? BuildSportNames(x.Sports) : "", HOFFlag = x.HOFFlag == true ? "HOF" : "", HeismanFlag = x.HeismanFlag == true ? "Heisman" : "", NotableFlag = x.NotableFlag == true ? "Notable" : "", }) .ToList(); var personSearchViewModel = new PersonIndex { PersonFilterOptionsViewModel = filterOptionsViewModel, People = peopleList, Sports = MvcService.BuildSportsSelectList(sports, personSearchFilterOptions.SportId ?? 0), Leagues = MvcService.BuildLeaguesSelectList(leagues, personSearchFilterOptions.LeagueId ?? 0), Teams = MvcService.BuildTeamsSelectList(teams, personSearchFilterOptions.TeamId ?? 0) }; return(personSearchViewModel); }
public CollegeDetails Build(int id, CardFilterOptionsViewModel filterOptionsVM, bool hasOwnerRights) { if (filterOptionsVM == null) { filterOptionsVM = new CardFilterOptionsViewModel(); } filterOptionsVM.CollegeId = id; var defaultFilterOptionsVM = new CardFilterOptionsViewModel { CollegeId = id }; var cardFilterOptions = SearchFilterService.BuildCardSearchFilterOptions(filterOptionsVM); var defaultFilterOptions = SearchFilterService.BuildCardSearchFilterOptions(defaultFilterOptionsVM); var college = _collegeService.Get(id); var cardSearch = _cardSearchService.Get(cardFilterOptions); var people = _cardSearchService.GetPeople(defaultFilterOptions); var teams = _cardSearchService.GetTeams(defaultFilterOptions); var cards = cardSearch.Cards .Select(x => new CardListItemViewModel { Id = x.Id, CardNumber = x.CardNumber != null? x.CardNumber.ToString() : "--", FormattedCost = FormatService.FormatDollars(x.Cost), FormattedValue = FormatService.FormatDollars(x.Value), PersonName = x.Person == null ? "" : x.Person.ToString(), PersonId = x.Person == null ? 0 : x.Person.Id, TeamName = x.Team == null ? "" : x.Team.ToString(), TeamId = x.Team == null ? 0 : x.Team.Id, Grade = x.Grade == null ? "" : x.Grade.Name, Company = x.SetName, RC = x.RCFlag ? "RC" : "", HOF = x.Person != null ? x.Person.HOFFlag ? "(HOF)" : "" : "", Year = x.Year.ToString(), Attributes = FormatService.BuildAttributes(x) }) .ToList(); var collegeViewModel = new CollegeDetails { Id = college.Id, Identifier = college.Identifier, DisplayName = college.ToString(), HasOwnerRights = hasOwnerRights, Cards = cards, SearchTotalsVM = new SearchTotalsViewModel { NumCollectibles = cardSearch.NumCards, TotalCost = cardSearch.TotalCost, ShowTotalCost = hasOwnerRights, TotalValue = cardSearch.TotalValue }, FilterOptionsVM = new CardSearchViewModel { People = MvcService.BuildPeopleSelectList(people, filterOptionsVM.PersonId), Teams = MvcService.BuildTeamsSelectList(teams, filterOptionsVM.TeamId), FilterOptions = filterOptionsVM } }; return(collegeViewModel); }
public PersonDetails Build(int id, CardFilterOptionsViewModel filterOptionsVM, bool hasOwnerRights) { if (filterOptionsVM == null) { filterOptionsVM = new CardFilterOptionsViewModel(); } filterOptionsVM.PersonId = id; var defaultFilterOptionsVM = new CardFilterOptionsViewModel { PersonId = id }; if (filterOptionsVM == null) { filterOptionsVM = defaultFilterOptionsVM; } var cardFilterOptions = SearchFilterService.BuildCardSearchFilterOptions(filterOptionsVM); var defaultFilterOptions = SearchFilterService.BuildCardSearchFilterOptions(defaultFilterOptionsVM); var person = _personService.Get(id); var cardSearch = _cardSearchService.Get(cardFilterOptions); var teams = _cardSearchService.GetTeams(defaultFilterOptions); var cards = cardSearch.Cards .Select(x => new CardListItemViewModel { Id = x.Id, CardNumber = x.CardNumber != null ? x.CardNumber.ToString() : "--", FormattedCost = FormatService.FormatDollars(x.Cost), FormattedValue = FormatService.FormatDollars(x.Value), PersonName = x.Person == null ? "" : x.Person.ToString(), PersonId = x.Person == null ? 0 : x.Person.Id, TeamName = x.Team == null ? "" : x.Team.ToString(), TeamId = x.Team == null ? 0 : x.Team.Id, Grade = x.Grade == null ? "" : x.Grade.Name, Company = x.SetName, RC = x.RCFlag ? "RC" : "", HOF = x.Person == null ? "" : x.Person.HOFFlag ? "HOF" : "", Year = x.Year.ToString(), CardType = x.CardType == null ? "" : x.CardType.Name == "Player" ? "" : x.CardType.Name, Attributes = FormatService.BuildAttributes(x) }) .ToList(); var displayName = person.Name; if (person.HOFFlag) { displayName += " (HOF)"; } var personDetailsViewModel = new PersonDetails { Id = person.Id, Identifier = person.Identifier, Cards = cards, DisplayName = displayName, HasOwnerRights = hasOwnerRights, SearchTotalsVM = new SearchTotalsViewModel { NumCollectibles = cardSearch.NumCards, TotalCost = cardSearch.TotalCost, TotalValue = cardSearch.TotalValue }, FilterOptionsVM = new CardSearchViewModel { Teams = MvcService.BuildTeamsSelectList(teams, cardFilterOptions.TeamId ?? 0), MinValues = MvcService.BuildValuesSelectList(cardFilterOptions.MinValue ?? 0), MaxValues = MvcService.BuildValuesSelectList(cardFilterOptions.MaxValue ?? 0), ShowPeopleFilters = "hidden", FilterOptions = filterOptionsVM } }; return(personDetailsViewModel); }
public ProductDetails Build(int id, CardFilterOptionsViewModel filterOptionsVM, bool hasOwnerRights) { if (filterOptionsVM == null) { filterOptionsVM = new CardFilterOptionsViewModel { ProductId = id, PersonId = 0, CollegeId = 0, TeamId = 0, LeagueId = 0 }; } filterOptionsVM.ProductId = id; var defaultFilterOptionsVM = new CardFilterOptionsViewModel { ProductId = id, PersonId = 0, CollegeId = 0, TeamId = 0, LeagueId = 0 }; var cardFilterOptions = SearchFilterService.BuildCardSearchFilterOptions(filterOptionsVM); var defaultFilterOptions = SearchFilterService.BuildCardSearchFilterOptions(defaultFilterOptionsVM); var product = _productService.Get(id); var cardSearch = _cardSearchService.Get(cardFilterOptions); var people = _cardSearchService.GetPeople(defaultFilterOptions); var teams = _cardSearchService.GetTeams(defaultFilterOptions); var colleges = _cardSearchService.GetColleges(defaultFilterOptions); var grades = _cardSearchService.GetGrades(defaultFilterOptions); var graders = _cardSearchService.GetGraders(defaultFilterOptions); var cards = cardSearch.Cards .Select(x => new CardListItemViewModel { Id = x.Id, CardNumber = x.CardNumber != null ? x.CardNumber.ToString() : "--", FormattedCost = FormatService.FormatDollars(x.Cost), FormattedValue = FormatService.FormatDollars(x.Value), PersonName = x.Person == null ? "" : x.Person.ToString(), PersonId = x.Person == null ? 0 : x.Person.Id, TeamName = x.Team == null ? "" : x.Team.ToString(), TeamId = x.Team == null ? 0 : x.Team.Id, Company = x.SetName, Grade = x.Grade != null ? x.Grade.Name : "", GraderName = x.Grade != null ? x.Grade.GraderName : "", RC = x.RCFlag ? "RC" : "", HOF = x.Person == null ? "" : x.Person.HOFFlag ? " (HOF)" : "", Year = x.Year.ToString(), Attributes = FormatService.BuildAttributes(x) }) .ToList(); var productDetailsViewModel = new ProductDetails { Id = product.Id, Identifier = product.Identifier, DisplayName = product.Name, Price = product.Price, HasOwnerRights = false, // need to revisit this Cards = cards, SearchTotalsVM = new SearchTotalsViewModel { NumCollectibles = cardSearch.NumCards, TotalCost = cardSearch.TotalCost, TotalValue = cardSearch.TotalValue }, FilterOptionsVM = new CardSearchViewModel { ShowPeopleFilters = "", ShowHeismanFilter = product.Name == "Football" ? "" : "hidden", People = MvcService.BuildPeopleSelectList(people, cardFilterOptions.PersonId ?? 0), Teams = MvcService.BuildTeamsSelectList(teams, cardFilterOptions.TeamId ?? 0), Colleges = MvcService.BuildCollegesSelectList(colleges, cardFilterOptions.CollegeId ?? 0), Graders = MvcService.BuildGradersSelectList(graders, cardFilterOptions.GraderId ?? 0), Grades = MvcService.BuildGradesSelectList(grades, cardFilterOptions.GradeId ?? 0), MinValues = MvcService.BuildValuesSelectList(cardFilterOptions.MinValue ?? 0), MaxValues = MvcService.BuildValuesSelectList(cardFilterOptions.MaxValue ?? 0) } }; return(productDetailsViewModel); }
public SportDetails Build(int id, CardFilterOptionsViewModel filterOptionsVM, bool hasOwnerRights) { var leagues = _leagueService.Get().Where(x => x.SportId == id).ToList(); var defaultLeague = leagues.SingleOrDefault(x => x.SportId == id && x.SearchDefault); if (filterOptionsVM == null) { filterOptionsVM = new CardFilterOptionsViewModel { SportId = id, PersonId = 0, CollegeId = 0, TeamId = 0, LeagueId = defaultLeague != null ? defaultLeague.Id : 0 }; } filterOptionsVM.SportId = id; var defaultFilterOptionsVM = new CardFilterOptionsViewModel { SportId = id, PersonId = 0, CollegeId = 0, TeamId = 0, LeagueId = defaultLeague != null ? defaultLeague.Id : 0 }; var cardFilterOptions = SearchFilterService.BuildCardSearchFilterOptions(filterOptionsVM); var defaultFilterOptions = SearchFilterService.BuildCardSearchFilterOptions(defaultFilterOptionsVM); var sport = _sportService.Get(id); var cardSearch = _cardSearchService.Get(cardFilterOptions); var people = _cardSearchService.GetPeople(defaultFilterOptions); var teams = _cardSearchService.GetTeams(defaultFilterOptions); var colleges = _cardSearchService.GetColleges(defaultFilterOptions); var grades = _cardSearchService.GetGrades(defaultFilterOptions); var graders = _cardSearchService.GetGraders(defaultFilterOptions); var cards = cardSearch.Cards .Select(x => new CardListItemViewModel { Id = x.Id, CardNumber = x.CardNumber != null ? x.CardNumber.ToString() : "--", FormattedCost = FormatService.FormatDollars(x.Cost), FormattedValue = FormatService.FormatDollars(x.Value), PersonName = x.Person == null ? "" : x.Person.ToString(), PersonId = x.Person == null ? 0 : x.Person.Id, TeamName = x.Team == null ? "" : x.Team.ToString(), TeamId = x.Team == null ? 0 : x.Team.Id, Company = x.SetName, Grade = x.Grade != null ? x.Grade.Name : "", GraderName = x.Grade != null ? x.Grade.GraderName : "", RC = x.RCFlag ? "RC" : "", HOF = x.Person == null ? "" : x.Person.HOFFlag ? " (HOF)" : "", Year = x.Year.ToString(), Attributes = FormatService.BuildAttributes(x) }) .ToList(); var sportDetailsViewModel = new SportDetails { Id = sport.Id, Identifier = sport.Identifier, DisplayName = string.Format("{0} Cards", sport.Name), HasOwnerRights = hasOwnerRights, Cards = cards, SearchTotalsVM = new SearchTotalsViewModel { NumCollectibles = cardSearch.NumCards, TotalCost = cardSearch.TotalCost, ShowTotalCost = hasOwnerRights, TotalValue = cardSearch.TotalValue }, FilterOptionsVM = new CardSearchViewModel { ShowPeopleFilters = "", ShowHeismanFilter = sport.Name == "Football" ? "" : "hidden", People = MvcService.BuildPeopleSelectList(people, cardFilterOptions.PersonId ?? 0), Leagues = MvcService.BuildLeaguesSelectList(leagues, cardFilterOptions.LeagueId ?? 0), Teams = MvcService.BuildTeamsSelectList(teams, cardFilterOptions.TeamId ?? 0), Colleges = MvcService.BuildCollegesSelectList(colleges, cardFilterOptions.CollegeId ?? 0), Graders = MvcService.BuildGradersSelectList(graders, cardFilterOptions.GraderId ?? 0), Grades = MvcService.BuildGradesSelectList(grades, cardFilterOptions.GradeId ?? 0), MinValues = MvcService.BuildValuesSelectList(cardFilterOptions.MinValue ?? 0), MaxValues = MvcService.BuildValuesSelectList(cardFilterOptions.MaxValue ?? 0) } }; return(sportDetailsViewModel); }