public static ICollection<Category> GetAllCategories()
 {
     // The using statement prevents read/write errors with database. - Parsons
     // source: http://robertgreiner.com/2012/07/entity-framework-open-datareader-associated-with-command/
     using (var ctx = new OrderingSystemDbContext())
     {
         return ctx.Categories.ToList();
     }
 }
Ejemplo n.º 2
0
 public static User FindUserByEmailAndPassword(string email, string password, OrderingSystemDbContext db)
 {
     return db.Users.FirstOrDefault(x => x.Email.Equals(email) && x.Password.Equals(password));
 }