public virtual ActionResult Search(SmsTemplateSearchFilter model)
        {
            ViewBag.Keys  = GetKeys();
            ViewBag.Types = GetTypes();
            var result = _SmsTemplateBusiness.Get(model);

            if (!Request.IsAjaxRequest())
            {
                return(View(result));
            }

            return(PartialView(MVC.SmsTemplate.Views.Partials._SearchList, result.Result));
        }
        public IActionResponse <List <SmsTemplate> > Get(SmsTemplateSearchFilter filterModel)
        {
            var response = new ActionResponse <List <SmsTemplate> >();
            var q        = _SmsTemplate.AsNoTracking().AsQueryable().Where(x => !x.IsDeleted);

            if (filterModel.Key != null)
            {
                q = q.Where(x => x.Key == filterModel.Key.ToString());
            }
            if (!string.IsNullOrWhiteSpace(filterModel.Text))
            {
                q = q.Where(x => x.Text.Contains(filterModel.Text));
            }
            response.Result = q.OrderByDescending(x => x.SmsTemplateId)
                              .Select(s => s)
                              .Take(filterModel.ItemsCount)
                              .ToList();
            return(response);
        }