public IActionResult Grid(PersonFlagCommentSearchModel model) { model = InitializeModel(model); var result = _customerFacadeApiClient.GetPersonFlagComments(model).Result; return(PartialView(result)); }
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); }
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); }
public async Task <PersonFlagCommentSearchModel> GetPersonFlagComments(PersonFlagCommentSearchModel model) { return(await _personFlagCommentApiClient.GetPersonFlagComments(model)); }
private PersonFlagCommentSearchModel InitializeModel(PersonFlagCommentSearchModel model) { model = InitializeSearchModel(model, "PersonFlagCommentGrid", "RaisedOn", "Desc"); return(model); }