Пример #1
0
        public async Task <bool> UserIsExist(string login, string password)
        {
            string hashedPassword = MD5Algorithm.GetHashString(password);

            UserEntity user = await _context.Users.FirstOrDefaultAsync(x => x.Login == login &&
                                                                       x.Password == hashedPassword);

            return(!(user is null));
        }
Пример #2
0
        public async Task Create(User user)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            user.Password = MD5Algorithm.GetHashString(user.Password);

            await _usersRepository.Create(user.Adapt <UserEntity>());
        }