Exemple #1
0
 static private bool add(string FirstName, string LastName)
 {
     using (SimpleDbContext ctx = new SimpleDbContext())
     {
         ctx.Users.Add(new User() { FirstName = FirstName, LastName = LastName });
         ctx.SaveChanges();
     }
     return false;
 }
Exemple #2
0
 static private bool contains(string FirstName, string LastName)
 {
     using (SimpleDbContext ctx = new SimpleDbContext())
     {
         if (ctx.Users.Where<User>(u => u.LastName == LastName).Where<User>(u => u.FirstName == FirstName).Any<User>())
         {
             return true;
         }
     }
     return false;
 }
Exemple #3
0
 static private void view()
 {
     using (SimpleDbContext ctx = new SimpleDbContext())
     {
         List<User> users = ctx.Users.SqlQuery("select * from users").ToList<User>();
         Console.WriteLine();
         Console.WriteLine("Lista userów:");
         foreach (var user in users)
         {
             Console.WriteLine(user);
         }
         Console.ReadLine();
     }
 }