Example #1
0
        public async Task <User> Login(string login, string password)
        {
            User user;

            var dbs = new DataBaseService();

            if (dbs.Login(login, password))
            {
                user = new User(login, password, dbs.GetRoots(login), dbs.GetValidity(login));
            }
            else
            {
                user = new User("invalid", "invalid", "invalid", false);
            }

            return(user);
        }
        public async Task <User> Register(string login, string password)
        {
            var dbs = new DataBaseService();

            var isSuccessful = true;

            if (!dbs.IsOnBase(login))
            {
                File.AppendAllText(@"D:\Study\МТ\Course\textedb\database.txt", login + ":" + password + ":" + "user" + ":" + "true" + "\r\n");
            }
            else
            {
                isSuccessful = false;
            }

            return(new User(login, password, "user", isSuccessful));
        }