public IActionResult Grid(PersonCaseSearchModel model) { model = InitializeModel(model); var result = _customerFacadeApiClient.GetPersonCases(model).Result; return(PartialView(result)); }
public async Task <PersonCaseSearchModel> GetPersonCases(PersonCaseSearchModel model) { var url = ODataApiUri + "/PersonCase?" + 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.PersonCaseSearchResult.Clear(); try { model.PersonCaseSearchResult.AddRange(result.Items.Select(item => JsonConvert.DeserializeObject <PersonCaseDto>(item.ToString()))); } catch (Exception e) { Console.WriteLine(e); throw; } return(model); }
public IActionResult PersonCase(PersonCaseSearchModel model) { model = InitializePersonCaseModel(model); if (Request.IsAjaxRequest()) { model = _customerApiClient.GetPersonCases(model).Result; return(PartialView("PersonCase", model)); } return(View(model)); }
private string GetFilterString(PersonCaseSearchModel 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"; filterString += $" or contains(Details,'{searchModel.FilterText}') eq true"; } AddPageSizeNumberAndSortingInFilterString(searchModel, ref filterString); return(filterString); }
private PersonCaseSearchModel InitializeModel(PersonCaseSearchModel model) { model = InitializeSearchModel(model, "PersonCaseGrid", "RaisedOn", "Desc"); return(model); }
public async Task <PersonCaseSearchModel> GetPersonCases(PersonCaseSearchModel model) { return(await _personCaseApiClient.GetPersonCases(model)); }