예제 #1
0
        public IActionResult Grid(PersonFlagSearchModel model)
        {
            model = InitializeModel(model);
            var result = _customerFacadeApiClient.GetPersonFlags(model).Result;

            return(PartialView(result));
        }
예제 #2
0
 public IActionResult PersonFlag(PersonFlagSearchModel model)
 {
     model = InitializePersonFlagModel(model);
     if (Request.IsAjaxRequest())
     {
         model = _customerApiClient.GetPersonFlags(model).Result;
         return(PartialView("PersonFlag", model));
     }
     return(View(model));
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 public async Task <PersonFlagSearchModel> GetPersonFlags(PersonFlagSearchModel model)
 {
     return(await _personFlagApiClient.GetPersonFlags(model));
 }
예제 #6
0
 private PersonFlagSearchModel InitializeModel(PersonFlagSearchModel model)
 {
     model = InitializeSearchModel(model, "PersonFlagGrid", "RaisedOn", "Desc");
     return(model);
 }