public ActionResult Index(string searchTerm) { searchTerm = searchTerm?.ToLower(); string result; if (string.IsNullOrEmpty(searchTerm)) { result = _appService.GetAll(); } else { ICollection <QueryFilter> filters = new List <QueryFilter>(); QueryFilter filter = new QueryFilter("Name", searchTerm, Operator.StartsWith); filters.Add(filter); result = _appService.Find(filters); } IEnumerable <TagVm> tags = string.IsNullOrEmpty(result) ? new List <TagVm>() : JsonConvert.DeserializeObject <IEnumerable <TagVm> >(result); tags = tags.OrderBy(t => t.Name); if (Request.IsAjaxRequest()) { return(PartialView("_TagTable", tags)); } return(View(tags)); }
public async Task <JsonResult> GetData(int?draw, int start, int length, string tagKeyStr) { var pageList = await _tagAppService.GetAll(new GetAllTagDto() { SkipCount = start, MaxResultCount = length, TagKeyStr = tagKeyStr }); return(Json(pageList.Items.Select(m => new { m.Id, m.TagName, m.TagNum }).ToList())); }
public async Task <JsonResult> GetList() { QueryTagFilter filter = new QueryTagFilter(); filter.limit = int.Parse(Request.Query["limit"]); filter.page = int.Parse(Request.Query["page"]); filter.name = Request.Query["name"]; var result = await _tagAppService.GetAll(filter); OutputModel outputModel = new OutputModel(); outputModel.Data = result; return(new JsonResult(outputModel)); }