Example #1
0
        static void RemoveTheDesert()
        {
            var db            = new SafariContext();
            var removeDessert = db.Safaris.Where(Safari => Safari.LocationOfLastSeen == "Dessert");

            db.Safaris.RemoveRange(removeDessert);
            db.SaveChanges();
        }
Example #2
0
        static void UpdateData()
        {
            var db            = new SafariContext();
            var updateSpecies = db.Safaris.FirstOrDefault(Safari => Safari.Species == "Stephen Gacio");

            updateSpecies.CountOfTimesSeen   = 50;
            updateSpecies.LocationOfLastSeen = "SDG";
            db.SaveChanges();
        }
Example #3
0
        static void SeedData()
        {
            var db = new SafariContext();
            var favoriteAdventure = new Safari
            {
                Species            = "Stephen Gacio",
                CountOfTimesSeen   = 123123,
                LocationOfLastSeen = "Outside of his natural environment"
            };
            var favoriteAdventure2 = new Safari
            {
                Species            = "Lion",
                CountOfTimesSeen   = 2,
                LocationOfLastSeen = "Safari"
            };
            var favoriteAdventure3 = new Safari
            {
                Species            = "Cougar",
                CountOfTimesSeen   = 400,
                LocationOfLastSeen = "Starbucks "
            };
            var favoriteAdventure4 = new Safari
            {
                Species            = "Lion",
                CountOfTimesSeen   = 420,
                LocationOfLastSeen = "walmart"
            };
            var favoriteAdventure5 = new Safari
            {
                Species            = "Tiger",
                CountOfTimesSeen   = 123123,
                LocationOfLastSeen = "My Driveway"
            };
            var favoriteAdventure6 = new Safari
            {
                Species            = "Bear",
                CountOfTimesSeen   = 1,
                LocationOfLastSeen = "Desert"
            };

            //   db.Safaris.Add(favoriteAdventure);
            //   db.Safaris.Add(favoriteAdventure2);
            //   db.Safaris.Add(favoriteAdventure3);
            //   db.Safaris.Add(favoriteAdventure4);
            //   db.Safaris.Add(favoriteAdventure5);
            //   db.Safaris.Add(favoriteAdventure6);
            db.SaveChanges();
        }