예제 #1
0
        public IActionResult Grid(AddressTypeSearchModel model)
        {
            model = InitializeModel(model);
            var result = _lookupFacadeApiClient.GetAddressTypes(model).Result;

            return(PartialView(result));
        }
예제 #2
0
        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);
        }
예제 #3
0
 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);
 }
예제 #4
0
 public async Task <AddressTypeSearchModel> GetAddressTypes(AddressTypeSearchModel model)
 {
     return(await _addressTypeApiClient.GetAddressTypes(model));
 }