public IActionResult Grid(AddressTypeSearchModel model) { model = InitializeModel(model); var result = _lookupFacadeApiClient.GetAddressTypes(model).Result; return(PartialView(result)); }
public async Task <AddressTypeSearchModel> GetAddressTypes(AddressTypeSearchModel model) { var url = ODataApiUri + "/AddressType?" + GetFilterStringForLookup(model); var result = await GetOdataResultFromApi(url); var searchResultCount = 0; if (result.Count != null) { int.TryParse(result.Count.ToString(), out searchResultCount); } model.TotalRows = searchResultCount; model.AddressTypeSearchResult.Clear(); model.AddressTypeSearchResult.AddRange(result.Items.Select(item => JsonConvert.DeserializeObject <AddressTypeDto>(item.ToString()))); return(model); }
private AddressTypeSearchModel InitializeModel(AddressTypeSearchModel model) { if (model == null) { model = new AddressTypeSearchModel { SortColumn = "Name", SortDirection = "Asc", PageSize = 8, PageNumber = 1 }; } else { if (string.IsNullOrWhiteSpace(model.SortColumn)) { model.SortColumn = "Name"; model.SortDirection = "Asc"; } } model.TargetGridId = "AddressTypeGrid"; return(model); }
public async Task <AddressTypeSearchModel> GetAddressTypes(AddressTypeSearchModel model) { return(await _addressTypeApiClient.GetAddressTypes(model)); }