private static DbContext InitializeDatabase()
        {
            var context = new FreelancerCorpDbContext();

            //context.Users.RemoveRange(context.Users);
            //context.Users.RemoveRange(context.Users);
            //context.Users.RemoveRange(context.Users);
            //context.Offers.RemoveRange(context.Offers);
            //context.Ratings.RemoveRange(context.Ratings);
            //context.SaveChanges();

            //context.Users.Add(new Freelancer(Sex.MALE, new DateTime(1968, 12, 5), "Bardejov", "*****@*****.**", "Karol Kovach", "som super"));
            //context.Users.Add(new Freelancer(Sex.MALE, new DateTime(1954, 3, 9), "Brno", "*****@*****.**", "Pavel Mnich", "milujte jedlo"));
            //context.Users.Add(new Freelancer(Sex.TRANSGENDER, new DateTime(1997, 5, 15), "Liberec", "*****@*****.**", "Simon Sarafy", "nemam problem"));

            //context.Users.Add(new Corporation("Úzka 12, Zvolen 925 25", "*****@*****.**", "GreatCorp", "berieme kazdeho"));
            //context.Users.Add(new Corporation("Adresna 0, Niekde 999 99", "*****@*****.**", "NejakyCorp", "nechod sem"));
            //context.Users.Add(new Corporation("Adresna 0, Niekde 999 99", "*****@*****.**", "NoCorp", "navzdy zatvorene"));

            //context.Offers.Add(new Offer(Category.GRAPHICS, "usable 3d model", 50, 1, "what", "but not so pretty"));

            //context.Ratings.Add(new Rating(0, 1, "what the hell"));

            context.SaveChanges();

            return(context);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            using (var db = new FreelancerCorpDbContext()) {
                db.Freelancers.Add(new Freelancer(Sex.TRANSGENDER, new DateTime(1955, 7, 31), "VajdaLand", "", "Imre Gejza", ""));
                db.Corporations.Add(new Corporation("VajdaLand", "*****@*****.**", "Punch Job", ""));
                db.Freelancers.Add(new Freelancer(Sex.TRANSGENDER, new DateTime(1955, 7, 31), "VajdaLand", "", "Jozko Vajda", ""));

                var x = db.Freelancers.FirstOrDefault();
                Console.WriteLine(x.GetType());
                Console.ReadKey();

                db.SaveChanges();
            }
        }