Beispiel #1
0
        public static User Entry()
        {
            string login    = SetInformations.SetLogin();
            string password = SetInformations.SetPassword();

            using (var context = new CartContext())
            {
                return(context.Users.Where(user => user.Login == login && user.Password == password).SingleOrDefault());
            }
        }
Beispiel #2
0
        public static void Registration()
        {
            User newUser = new User()
            {
                Login    = SetInformations.SetLogin(),
                Password = SetInformations.SetPassword()
            };
            Cart newCart = new Cart()
            {
                User = newUser
            };

            using (var context = new CartContext())
            {
                if (context.Users.All(user => user.Login != newUser.Login))
                {
                    context.Carts.Add(newCart);
                    context.SaveChanges();
                }
            }
        }