Пример #1
0
        public Task<User> RegisterUser(string userName, string password, string fullName)
        {
            using (var context = new AngularTemplateContext())
            {
                var token = UserSecurity.EncryptText(userName, password);
                var user = new User { UserName = userName, FullName = fullName, Token = token };
                context.Users.Add(user);
                context.SaveChanges();

                return Task.FromResult(user);
            }
        }
Пример #2
0
        public Task<User> AuthenticateUser(string userName, string password)
        {
            using(var context = new AngularTemplateContext())
            {
                var user = context.Users
                    .Where(u => u.UserName == userName)
                    .FirstOrDefault();

                if (user != null)
                {

                }

                return Task.FromResult(user);
            }
        }