Ejemplo n.º 1
0
        public void Insert(Product product)
        {
            // not sure whether this will affect the Collectibles which are related to the Product.
            // currently, the domain drives the logic which updates each Collectible in the Product.
            // if hydrated Collectibles list is provided, it might handle those updates without
            // extra code.

            _qDb.Products.Add(product);
            _qDb.SaveChanges();
        }
Ejemplo n.º 2
0
        private static Collectible AddCollectible(QdbContext context, League league, Person person, Team team, Set set, int?cardNumber, int year, bool notableFlag, bool auFlag, bool rcFlag, bool gradedFlag, decimal value, decimal cost)
        {
            var collectible = new Collectible
            {
                CollectibleTypeId   = CollectibleTypeCodeService.Card.Id,
                CollectibleStatusId = CollectibleStatusCodeService.Available.Id,
                SportId             = league.SportId,
                LeagueId            = league.Id,
                CardNumber          = cardNumber,
                Person      = person,
                Team        = team,
                Set         = set,
                Year        = year,
                AUFlag      = auFlag,
                RCFlag      = rcFlag,
                NotableFlag = notableFlag,
                Value       = value,
                Cost        = cost,
                GradedFlag  = gradedFlag
            };

            context.Collectibles.Add(collectible);
            context.SaveChanges();

            return(collectible);
        }
Ejemplo n.º 3
0
        private static Person AddPerson(QdbContext context, string identifier, string lastName, string firstName, string middleName, string suffix, bool hofFlag, bool heismanFlag, bool notableFlag, Sport sport, College college)
        {
            var person = new Person
            {
                Identifier  = identifier,
                LastName    = lastName,
                FirstName   = firstName,
                MiddleName  = middleName,
                Suffix      = suffix,
                HOFFlag     = hofFlag,
                HeismanFlag = heismanFlag,
                NotableFlag = notableFlag,
                College     = college
            };
            var personSport = new PersonSport
            {
                Person = person,
                Sport  = sport
            };

            context.People.Add(person);
            context.PersonSports.Add(personSport);
            context.SaveChanges();

            return(person);
        }
Ejemplo n.º 4
0
        private static Set AddSet(QdbContext context, string name)
        {
            var set = new Set
            {
                Name = name
            };

            context.Sets.Add(set);
            context.SaveChanges();

            return(set);
        }
Ejemplo n.º 5
0
        private static Product AddProduct(QdbContext context, string identifier, int productStatusId)
        {
            var product = new Product
            {
                Identifier      = identifier,
                ProductStatusId = productStatusId
            };

            context.Products.Add(product);
            context.SaveChanges();

            return(product);
        }
Ejemplo n.º 6
0
        private static College AddCollege(QdbContext context, string identifier, string name, string nickname)
        {
            var college = new College
            {
                Identifier = identifier,
                Name       = name,
                Nickname   = nickname
            };

            context.Colleges.Add(college);
            context.SaveChanges();

            return(college);
        }
Ejemplo n.º 7
0
        private static Team AddTeam(QdbContext context, string identifier, string city, string nickname, League league, bool notableFlag)
        {
            var team = new Team
            {
                Identifier  = identifier,
                City        = city,
                Nickname    = nickname,
                SportId     = league.SportId,
                LeagueId    = league.Id,
                NotableFlag = notableFlag
            };

            context.Teams.Add(team);
            context.SaveChanges();

            return(team);
        }
Ejemplo n.º 8
0
        public static void SeedCodeValues(DbContextOptions <QdbContext> options)
        {
            using (var context = new QdbContext(options))
            {
                if (context.CollectibleStatuses.Count() > 0)
                {
                    return;
                }

                foreach (var cardType in CardTypeCodeService.Select())
                {
                    context.CardTypes.Add(cardType);
                }
                foreach (var collectibleStatus in CollectibleStatusCodeService.Select())
                {
                    context.CollectibleStatuses.Add(collectibleStatus);
                }
                foreach (var collectibleType in CollectibleTypeCodeService.Select())
                {
                    context.CollectibleTypes.Add(collectibleType);
                }
                foreach (var league in LeagueCodeService.Select())
                {
                    context.Leagues.Add(league);
                }
                foreach (var productStatus in ProductStatusCodeService.Select())
                {
                    context.ProductStatuses.Add(productStatus);
                }
                foreach (var sport in SportCodeService.Select())
                {
                    context.Sports.Add(sport);
                }

                context.SaveChanges();
            }
        }
Ejemplo n.º 9
0
 public void Insert(Team team)
 {
     _qDb.Teams.Add(team);
     _qDb.SaveChanges();
 }
Ejemplo n.º 10
0
 public void Insert(Grade grade)
 {
     _qDb.Grades.Add(grade);
     _qDb.SaveChanges();
 }
Ejemplo n.º 11
0
 public void Insert(Grader grader)
 {
     _qDb.Graders.Add(grader);
     _qDb.SaveChanges();
 }
Ejemplo n.º 12
0
 public void Insert(Person person)
 {
     _qDb.People.Add(person);
     _qDb.SaveChanges();
 }
 public void Insert(Container container)
 {
     _qDb.Containers.Add(container);
     _qDb.SaveChanges();
 }
Ejemplo n.º 14
0
 public void Insert(College college)
 {
     _qDb.Colleges.Add(college);
     _qDb.SaveChanges();
 }