public IActionResponse <List <Role> > Search(FilterRoleModel filterModel) { var response = new ActionResponse <List <Role> >(); var result = _role.Where(x => (!string.IsNullOrEmpty(filterModel.RoleNameEn) ? x.RoleNameEn.Contains(filterModel.RoleNameEn) : true) && (!string.IsNullOrEmpty(filterModel.RoleNameFa) ? x.RoleNameFa.Contains(filterModel.RoleNameFa) : true) && (filterModel.IsActive != null ? x.IsActive == filterModel.IsActive : true) && (filterModel.IsDefault != null ? x.IsDefault == filterModel.IsDefault : true) ) .OrderBy(x => x.RoleId) .Select(s => s) .Take(filterModel.ItemsCount) .ToList(); if (result.Any()) { response.IsSuccessful = true; } else { response.Message = BusinessMessage.UserNotFound; } response.Result = result; return(response); }
public virtual ActionResult Search(FilterRoleModel model) { GetIsActive(); GetIsDefault(); var result = _roleBusiness.Search(model); if (!Request.IsAjaxRequest()) { return(View(result)); } return(PartialView(MVC.Role.Views.Partials._SearchList, result.Result)); }