Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            using (var conn = new SqliteContext(@"testDb"))
            {
                conn.Rooms.Add(new Room()
                {
                    RoomNumber   = 2137,
                    RoomStandard = 4
                });

                conn.Customers.Add(new Customer()
                {
                    Name     = "Test",
                    LastName = "Test2"
                });

                conn.Reservations.Add(new Reservation()
                {
                    IdCustomer = conn.Customers.Select(x => x.Id).FirstOrDefault(),
                    IdRoom     = conn.Rooms.Select(x => x.Id).FirstOrDefault(),
                    StartTime  = DateTime.Now,
                    StopTime   = DateTime.MaxValue
                });

                conn.SaveChanges();

                var xd = conn.Reservations.FirstOrDefault();

                Console.ReadKey();
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            using (var db = new SqliteContext())
            {
                var people = db.Person.ToList();
                WriteLine($"Initialize People Count: {people.Count}");

                if (!people.Any())
                {
                    100.Create(() => new Person
                    {
                        Id      = Faker.RandomNumber.Next(1000),
                        Name    = Faker.Name.First(),
                        Surname = Faker.Name.Last()
                    }).ForEach(p => db.Person.Add(p));
                    db.SaveChanges();
                    people = db.Person.ToList();
                }

                WriteLine($"People Count After Add Proccess: {people.Count}");
            }

            ReadLine();
        }