예제 #1
0
        public Guid Login(LoginModel user)
        {
            //using (var _context = new CustomDbContext())
            //{
            var users = _context.Users.FirstOrDefault(u => u.Username == user.Username);

            if (users == null)
            {
                throw new ArgumentException();
            }

            if (PasswordHandler.Validate(user.Password, users.PasswordHash))
            {
                return(users.UserId);
            }

            return(Guid.NewGuid());
            //}
        }