public CollegeDTO Get(int id) { var college = _collegeService.Get(id); var cardFilterOptions = new CardSearchFilterOptions { CollegeId = id }; var cardSearch = _cardSearchService.Get(cardFilterOptions); var cardDTOs = cardSearch.Cards.Select(x => new CardDTO { Id = x.Id, CompanyName = x.SetName, CardNumber = x.CardNumber.ToString(), Year = x.Year.ToString(), RC = x.RCFlag ? "RC" : "", 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 }) .ToList(); var collegeDTO = new CollegeDTO { Id = college.Id, Name = college.Name, Cards = cardDTOs }; return(collegeDTO); }
public static CollectibleQueryFilterOptions BuildCollectibleFilterOptions(CardSearchFilterOptions cardFilterOptions) { var collectibleFilterOptions = new CollectibleQueryFilterOptions { ProductId = cardFilterOptions.ProductId, CollectibleTypeId = CollectibleTypeCodeService.Card.Id, SportId = cardFilterOptions.SportId, LeagueId = cardFilterOptions.LeagueId, PersonId = cardFilterOptions.PersonId, TeamId = cardFilterOptions.TeamId, HOFFlag = cardFilterOptions.HOFFlag, RCFlag = cardFilterOptions.RCFlag, RelicFlag = cardFilterOptions.RelicFlag, AutographedFlag = cardFilterOptions.AutographedFlag, NotableFlag = cardFilterOptions.NotableFlag, NotablePersonFlag = cardFilterOptions.NotablePersonFlag, CollegeId = cardFilterOptions.CollegeId, ContainerId = cardFilterOptions.ContainerId, GradedFlag = cardFilterOptions.GradedFlag, HeismanFlag = cardFilterOptions.HeismanFlag, VintageFlag = cardFilterOptions.VintageFlag, Year = cardFilterOptions.Year, GraderId = cardFilterOptions.GraderId, GradeId = cardFilterOptions.GradeId, ManufacturerId = cardFilterOptions.ManufacturerId, MinValue = cardFilterOptions.MinValue, MaxValue = cardFilterOptions.MaxValue, NoContainerFlag = cardFilterOptions.NoContainerFlag }; return(collectibleFilterOptions); }
public void FootballSearch_WithNoResults_Succeeds() { string dbName = "FootballSearch_WithNoResults_Succeeds"; // Create dependency injection provider using method as database name var serviceProvider = BuildServiceProvider(dbName); var options = GetContextOptions(dbName); // Retrieve services necessary for test var serviceToTest = serviceProvider.GetService <ICollectibleSearchService <CardSearch, CardSearchFilterOptions> >(); // Add Code Values for sports, leagues, collectible types, and collectible statuses SeedService.SeedCodeValues(options); // Seed a single baseball card SeedService.SeedCard(options, "MLB", 1, "Montana", "Joe", "San Francisco", "49ers", 1981, "Topps", false, true, true, false, 100, 80); // Run test to search for football cards var filterOptions = new CardSearchFilterOptions { SportId = SportCodeService.Football.Id }; var collectibleSearch = serviceToTest.Get(filterOptions); // Verify that results returned zero football cards Assert.Equal(0, collectibleSearch.NumCards); }
public static CardSearchFilterOptions BuildCardSearchFilterOptions(CardFilterOptionsViewModel cardFilterOptions) { if (cardFilterOptions == null) { return(null); } var cardSearchFilterOptions = new CardSearchFilterOptions { ProductId = GetNullableId(cardFilterOptions.ProductId), SportId = GetNullableId(cardFilterOptions.SportId), LeagueId = GetNullableId(cardFilterOptions.LeagueId), PersonId = GetNullableId(cardFilterOptions.PersonId), TeamId = GetNullableId(cardFilterOptions.TeamId), CollegeId = GetNullableId(cardFilterOptions.CollegeId), HOFFlag = cardFilterOptions.HOFFlag, RCFlag = cardFilterOptions.RCFlag, AutographedFlag = cardFilterOptions.AUFlag, RelicFlag = cardFilterOptions.RelicFlag, NotableFlag = cardFilterOptions.NotableFlag, NotablePersonFlag = cardFilterOptions.NotablePersonFlag, GradedFlag = cardFilterOptions.GradedFlag, HeismanFlag = cardFilterOptions.HeismanFlag, VintageFlag = cardFilterOptions.VintageFlag, Year = cardFilterOptions.Year, GraderId = GetNullableId(cardFilterOptions.GraderId), GradeId = GetNullableId(cardFilterOptions.GradeId), ManufacturerId = GetNullableId(cardFilterOptions.ManufacturerId), MinValue = GetNullableValue(cardFilterOptions.MinValue), MaxValue = GetNullableValue(cardFilterOptions.MaxValue) }; return(cardSearchFilterOptions); }
public ContainerForm(ICrudService <Quinlan.Domain.Models.Container> containerService, ICrudService <Card> cardService, ICollectibleSearchService <CardSearch, CardSearchFilterOptions> cardSearchService, int containerId) { InitializeComponent(); _containerService = containerService; _cardService = cardService; _cardSearchService = cardSearchService; _containerId = containerId; var container = _containerService.Get(_containerId); labelContainerCards.Text = string.Format("Cards in {0}", container.Name); _availableFilterOptions = new CardSearchFilterOptions { NoContainerFlag = true }; RefreshAvailable(); RefreshContainer(); }