Exemplo n.º 1
0
        /// <summary>
        /// Method that validates a user's username and password
        /// </summary>
        public async Task <Writter.Domain.Entities.User> AutenticateUser(Writter.Domain.Dto.WritterLoginRequest user)
        {
            var users = await _repository.AutenticateUser(user);

            if (users == null)
            {
                throw new Exception("credenciales incorrectas");
            }

            return(users);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method that validates a user's username and password
        /// </summary>
        public async Task <Writter.Domain.Entities.User> AutenticateUser(Writter.Domain.Dto.WritterLoginRequest user)
        {
            try
            {
                var LoginUsers = await _context.User.
                                 FirstOrDefaultAsync(x => x.user_login == user.user_login &&
                                                     user.password_login == user.password_login);

                return(LoginUsers);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                _context.Dispose();
            }
        }