Exemple #1
0
        public UserResponse Login(string user, string pass)
        {
            User   resultantUser = _context.GetAll().Where(u => (u.Username.Equals(user) && u.Password.Equals(pass)) || (u.Email.Equals(user) && u.Password.Equals(pass))).FirstOrDefault();
            string token         = null;

            if (resultantUser != null)
            {
                token = _auth.Authentication(resultantUser.Id.ToString());
            }
            return(new UserResponse {
                Fullname = resultantUser.Fullname,
                Email = resultantUser.Email,
                Address = resultantUser.Address,
                Id = resultantUser.Id,
                Token = token
            });
        }
Exemple #2
0
 public IActionResult Get()
 {
     return(Ok(_roleRepository.GetAll()));
 }