示例#1
0
        public IActionResult Grid(PersonFlagCommentSearchModel model)
        {
            model = InitializeModel(model);
            var result = _customerFacadeApiClient.GetPersonFlagComments(model).Result;

            return(PartialView(result));
        }
示例#2
0
        public async Task <PersonFlagCommentSearchModel> GetPersonFlagComments(PersonFlagCommentSearchModel model)
        {
            var url    = ODataApiUri + "/PersonFlagComment?" + 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.PersonFlagCommentSearchResult.Clear();
            model.PersonFlagCommentSearchResult.AddRange(result.Items.Select(item => JsonConvert.DeserializeObject <PersonFlagCommentDto>(item.ToString())));
            return(model);
        }
示例#3
0
        private string GetFilterString(PersonFlagCommentSearchModel searchModel)
        {
            var filterString = ODataFilterConstant.Expand + $"Person";

            if (searchModel.PersonId > 0)
            {
                filterString += ODataFilterConstant.Filter + $"PersonId eq {searchModel.PersonId}";
            }
            if (!string.IsNullOrWhiteSpace(searchModel.FilterText))
            {
                if (string.IsNullOrWhiteSpace(filterString))
                {
                    filterString += ODataFilterConstant.Filter + $"contains(Person/Forename,'{searchModel.FilterText}') eq true";
                }
                else
                {
                    filterString += $" or contains(Person/Forename,'{searchModel.FilterText}') eq true";
                }
                filterString += $" or contains(Person/Surname,'{searchModel.FilterText}') eq true";
            }
            AddPageSizeNumberAndSortingInFilterString(searchModel, ref filterString);
            return(filterString);
        }
示例#4
0
 public async Task <PersonFlagCommentSearchModel> GetPersonFlagComments(PersonFlagCommentSearchModel model)
 {
     return(await _personFlagCommentApiClient.GetPersonFlagComments(model));
 }
示例#5
0
 private PersonFlagCommentSearchModel InitializeModel(PersonFlagCommentSearchModel model)
 {
     model = InitializeSearchModel(model, "PersonFlagCommentGrid", "RaisedOn", "Desc");
     return(model);
 }