public IActionResult Grid(PersonFlagSearchModel model) { model = InitializeModel(model); var result = _customerFacadeApiClient.GetPersonFlags(model).Result; return(PartialView(result)); }
public IActionResult PersonFlag(PersonFlagSearchModel model) { model = InitializePersonFlagModel(model); if (Request.IsAjaxRequest()) { model = _customerApiClient.GetPersonFlags(model).Result; return(PartialView("PersonFlag", model)); } return(View(model)); }
public async Task <PersonFlagSearchModel> GetPersonFlags(PersonFlagSearchModel model) { var url = ODataApiUri + "/PersonFlag?" + 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.PersonFlagSearchResult.Clear(); model.PersonFlagSearchResult.AddRange(result.Items.Select(item => JsonConvert.DeserializeObject <PersonFlagDto>(item.ToString()))); return(model); }
private string GetFilterString(PersonFlagSearchModel searchModel) { var filterString = ODataFilterConstant.Expand + $"Person,FlagType,FlagGroup,PersonFlagComments"; 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"; filterString += $" or contains(Details,'{searchModel.FilterText}') eq true"; } AddPageSizeNumberAndSortingInFilterString(searchModel, ref filterString); return(filterString); }
public async Task <PersonFlagSearchModel> GetPersonFlags(PersonFlagSearchModel model) { return(await _personFlagApiClient.GetPersonFlags(model)); }
private PersonFlagSearchModel InitializeModel(PersonFlagSearchModel model) { model = InitializeSearchModel(model, "PersonFlagGrid", "RaisedOn", "Desc"); return(model); }