Example #1
0
 /// <summary>
 /// lấy thông tin đầy đủ của user (bao gồm cả profiles)
 /// </summary>
 /// <returns></returns>
 public UserFullInfoVM GetUserFullInfo()
 {
     if (User != null)
     {
         return(ServiceAutoMapModelMapper.CreateUserFullInfo(User, UserProfileCollection));// new UserFullInfoVM(User, UserProfileCollection);
     }
     return(null);
 }
Example #2
0
        public ProfileUpdateInfoVM GetOrInitUserProfileUpdateInfo(string profilecode)
        {
            var userProfile = GetUserProfile(profilecode);

            if (userProfile != null)
            {
                return(ServiceAutoMapModelMapper.CreateProfileUpdateInfoVM(userProfile)); // new ProfileUpdateInfoVM(userProfile);
            }
            return(ServiceAutoMapModelMapper.CreateProfileUpdateInfoVM(_userId));         //new ProfileUpdateInfoVM(_userId);
        }
Example #3
0
        public LoginTokenModel GetOrInitLoginTokenDto(string domain)
        {
            if (!IsExitsUser)
            {
                return(new LoginTokenModel());
            }
            var uLoginToken = _userLoginTokenRepository.GetByDomain(domain, _userId) ?? new UserLoginToken();

            return(ServiceAutoMapModelMapper.CreateLoginTokenDto(uLoginToken));
        }
Example #4
0
        public List <UserShortInfoVM> GetAllUserShortInfo(int page = 0, int pageItems = int.MaxValue)
        {
            var result = new List <UserShortInfoVM>();
            var q      = _userRepository.GetAll().OrderByDescending(x => x.Id);
            var list   = q.Skip(page * pageItems).Take(pageItems).ToList();

            foreach (var item in list)
            {
                result.Add(ServiceAutoMapModelMapper.CreateUserShortInfo(item));
                //result.Add(new UserShortInfoVM(item));
            }
            return(result);
        }
Example #5
0
        public List <ProfileUpdateInfoVM> GetAllUserProfileUpdateInfo()
        {
            var result = new List <ProfileUpdateInfoVM>();

            if (UserProfileCollection.Any())
            {
                foreach (var item in UserProfileCollection)
                {
                    //result.Add(new ProfileUpdateInfoVM(item));
                    result.Add(ServiceAutoMapModelMapper.CreateProfileUpdateInfoVM(item));
                }
            }
            return(result);
        }
Example #6
0
        public List <UserShortInfoVM> GetAllUserShortInfo(UserStatusCollection status, out int totalItems, int page = 0, int pageItems = int.MaxValue)
        {
            var statusName = status.ToString();
            var result     = new List <UserShortInfoVM>();
            var q          = _userRepository.GetAll().Where(x => x.Status == statusName).OrderByDescending(x => x.Id);

            totalItems = q.Count();
            var list = q.Skip(page * pageItems).Take(pageItems).ToList();

            foreach (var item in list)
            {
                result.Add(ServiceAutoMapModelMapper.CreateUserShortInfo(item));
                //result.Add(new UserShortInfoVM(item));
            }
            return(result);
        }
Example #7
0
        /// <summary>
        /// thêm mới hoặc update thông tin profile của user
        /// </summary>
        /// <param name="profileInfo"></param>
        /// <returns></returns>
        public bool CreateOrUpdateUserProfile(ProfileUpdateInfoVM profileInfo)
        {
            var userProfile = GetUserProfile(profileInfo.ProfileId);

            if (userProfile == null)
            {
                userProfile = new UserProfile();
                _userProfileRepository.Add(userProfile);
            }
            userProfile = ServiceAutoMapModelMapper.MapExits <ProfileUpdateInfoVM, UserProfile>(profileInfo, userProfile);
            //ProfileUpdateInfoVM.ToModel(profileInfo, ref userProfile);

            userProfile.UserId = _userId;
            _userProfileRepository.Save();
            ResetDataCache();
            return(true);
        }
Example #8
0
        /// <summary>
        /// lấy thông tin userlogin của 1 token
        /// </summary>
        /// <param name="loginToken"></param>
        /// <returns></returns>
        public UserLoginTokenModel GetOrInitUserLoginTokenDto(string loginToken)
        {
            var uLoginToken = _userLoginTokenRepository.GetByToken(loginToken) ?? new UserLoginToken();

            return(ServiceAutoMapModelMapper.CreateUserLoginTokenDto(uLoginToken));
        }