Пример #1
0
        public IActionResult Grid(PersonAntiSocialBehaviourSearchModel model)
        {
            model = InitializeModel(model);
            var result = _customerFacadeApiClient.GetPersonAntiSocialBehaviours(model).Result;

            return(PartialView(result));
        }
Пример #2
0
 public IActionResult PersonAntiSocialBehaviour(PersonAntiSocialBehaviourSearchModel model)
 {
     model = InitializePersonAntiSocialBehaviourModel(model);
     if (Request.IsAjaxRequest())
     {
         model = _customerApiClient.GetPersonAntiSocialBehaviours(model).Result;
         return(PartialView("PersonAntiSocialBehaviour", model));
     }
     return(View(model));
 }
Пример #3
0
        private string GetFilterString(PersonAntiSocialBehaviourSearchModel searchModel)
        {
            var filterString = ODataFilterConstant.Expand + $"Person,PersonAntiSocialBehaviourCaseNotes";

            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";
            }
            AddPageSizeNumberAndSortingInFilterString(searchModel, ref filterString);
            return(filterString);
        }
Пример #4
0
        public async Task <PersonAntiSocialBehaviourSearchModel> GetPersonAntiSocialBehaviours(PersonAntiSocialBehaviourSearchModel model)
        {
            var url    = ODataApiUri + "/PersonAntiSocialBehaviour?" + 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.PersonAntiSocialBehaviourSearchResult.Clear();
            model.PersonAntiSocialBehaviourSearchResult.AddRange(result.Items.Select(item => JsonConvert.DeserializeObject <PersonAntiSocialBehaviourDto>(item.ToString())));
            return(model);
        }
Пример #5
0
 public async Task <PersonAntiSocialBehaviourSearchModel> GetPersonAntiSocialBehaviours(PersonAntiSocialBehaviourSearchModel model)
 {
     return(await _personAntiSocialBehaviourApiClient.GetPersonAntiSocialBehaviours(model));
 }
Пример #6
0
 private PersonAntiSocialBehaviourSearchModel InitializeModel(PersonAntiSocialBehaviourSearchModel model)
 {
     model = InitializeSearchModel(model, "PersonAntiSocialBehaviourGrid", "LoggedDate", "Desc");
     return(model);
 }