public async Task <SearchResult <LicenseSearchDTO> > SearchLicenses(SearchUserParams userParams)
        {
            var licenseResult = await _licenseDomainService.SearchLicenses(userParams, GetCurrentUserId());

            return(new SearchResult <LicenseSearchDTO> (
                       _mapper.Map <IEnumerable <LicenseSearchDTO> > (licenseResult.Results),
                       licenseResult.TotalCount));
        }
        public async Task <SearchResult <UserSearchDTO> > SearchUsers(SearchUserParams userParams)
        {
            var userSearchResults = await _userRepo.GetUsers(userParams.QueryString, userParams.PageNumber, userParams.PageSize);

            return(new SearchResult <UserSearchDTO>(
                       _autoMapper.Map <IEnumerable <UserSearchDTO> >(userSearchResults.Results),
                       userSearchResults.TotalCount
                       ));
        }
Example #3
0
        public async Task <SearchResult <SofaLicense> > GetLicenses(SearchUserParams userParams, long userId)
        {
            SearchResult <SofaLicense> licenseResult;
            var user = await _userRepo.Get(userId);

            if (user.Account.AccountTypeId == (int)AccountTypes.Administrator)
            {
                licenseResult = await _licenseRepo.GetLicenses(userParams.QueryString, userParams.PageNumber, userParams.PageSize);
            }
            else
            {
                licenseResult = await _licenseRepo.GetLicenses(userParams.QueryString, userParams.PageNumber, userParams.PageSize, user.UnitId);
            }
            return(licenseResult);
        }
Example #4
0
 public IHttpActionResult SearchUser([FromUri] SearchUserParams param)
 {
     if (param == null)
     {
         param = new SearchUserParams();
     }
     try
     {
         var data = _commentServices.SearchUser(param);
         if (!data.Any())
         {
             return(Ok(GlobalsEnum.GlobalStatus.NOT_FOUND.ToString()));
         }
         return(Ok(data));
     }
     catch (Exception ex)
     {
         NLog.LogManager.GetCurrentClassLogger().Debug("Search(): {0} - {1}" + ex.Message, ex.StackTrace);
         return(NoOK(GlobalsEnum.GlobalStatus.INVALID_DATA));
     }
 }
Example #5
0
        public async Task <SearchResult <SofaLicense> > SearchLicenses(SearchUserParams userParams, long userId)
        {
            SearchResult <SofaLicense> licenseResults;
            var user = await _userRepo.Get(userId);

            if (user == null)
            {
                throw new ArgumentException("Invalid User");
            }

            // CSS
            if (user.Account.AccountTypeId == (int)AccountTypes.Css)
            {
                licenseResults = await _licenseRepo.GetLicenses(userParams.QueryString, userParams.PageNumber, userParams.PageSize, user.UnitId);
            }
            // Admin
            else
            {
                licenseResults = await _licenseRepo.GetLicenses(userParams.QueryString, userParams.PageNumber, userParams.PageSize);
            }
            return(licenseResults);
        }
Example #6
0
 public async Task <IActionResult> SearchUsers([FromQuery] SearchUserParams userParams)
 {
     return(Ok(await _usersAppService.SearchUsers(userParams)));
 }