예제 #1
0
        public UserLoginInfo GetUserByEmailandPassword(string Email, string Password)
        {
            UserLoginInfo _userInfo = null;

            try
            {
                IList <usp_Users_LoginUserByEmailandPassword_Result> _vLoginUser = _context.usp_Users_LoginUserByEmailandPassword(Email, Password).ToList();
                if (_vLoginUser.Count > 0)
                {
                    _userInfo = _vLoginUser
                                .Select(x => new UserLoginInfo
                    {
                        UserID      = x.UserID,
                        UserName    = x.UserName,
                        Email       = x.Email,
                        Password    = x.Password,
                        FirstName   = x.FirstName,
                        LastName    = x.LastName,
                        MiddleName  = x.MiddleName,
                        DisplayName = x.DisplayName,
                        DisplayID   = x.DisplayID
                    }).FirstOrDefault();

                    _userInfo.Roles = (from r in _vLoginUser select r.RoleName).ToArray();
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error occured in UserService - GetUserByEmailandPassword", ex);
                _userInfo = null;
            }
            return(_userInfo);
        }