コード例 #1
0
        public async Task <UserSmsSearchModel> GetUserSmses(UserSmsSearchModel model)
        {
            var url    = ODataApiUri + "/UserSms?" + GetFilterString(model);
            var result = await GetOdataResultFromApi(url);

            var searchResultCount = 0;

            if (result.Count != null)
            {
                int.TryParse(result.Count.ToString(), out searchResultCount);
            }
            model.TotalRows = searchResultCount;
            model.UserSmsSearchResult.Clear();
            try
            {
                model.UserSmsSearchResult.AddRange(result.Items.Select(item => JsonConvert.DeserializeObject <UserSmsDto>(item.ToString())));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            return(model);
        }
コード例 #2
0
        private string GetFilterString(UserSmsSearchModel searchModel)
        {
            var filterString = string.Empty;

            if (searchModel != null)
            {
                if (!string.IsNullOrWhiteSpace(searchModel.FilterText))
                {
                    if (string.IsNullOrWhiteSpace(filterString))
                    {
                        filterString = ODataFilterConstant.Filter + $"contains(Forename,'{searchModel.FilterText}') eq true";
                    }
                    else
                    {
                        filterString += $" or contains(Forename,'{searchModel.FilterText}') eq true";
                    }
                    filterString += $" or contains(Surname,'{searchModel.FilterText}') eq true";
                }
                AddPageSizeNumberAndSortingInFilterString(searchModel, ref filterString);
            }
            return(filterString);
        }
コード例 #3
0
 public async Task <UserSmsSearchModel> GetUserSmses(UserSmsSearchModel model)
 {
     return(await _userSmsApiClient.GetUserSmses(model));
 }