Esempio n. 1
0
        public static void Registration()
        {
            Person newPerson = new Person()
            {
                Name    = SetInformation.SetName(),
                Surname = SetInformation.SetSurname(),
                Email   = SetInformation.SetEmail()
            };
            string login = SetInformation.SetLogin();

            using (var context = new TicketContext())
            {
                if (!(context.Users.Where(user => user.Login == login).ToList().Count == Constants.NULL))
                {
                    return;
                }
            }

            User newUser = new User()
            {
                Login    = login,
                Password = SetInformation.SetPassword(),
                Person   = newPerson
            };

            using (var context = new TicketContext())
            {
                context.Users.Add(newUser);
                context.SaveChanges();
            }
        }
Esempio n. 2
0
        public static User Entry()
        {
            string login    = SetInformation.SetLogin();
            string password = SetInformation.SetPassword();

            using (var context = new TicketContext())
            {
                return(context.Users.Where(user => user.Login == login && user.Password == password).SingleOrDefault());
            }
        }