public string Search(SchoolSearcher searcher) { var vm = CreateVM <SchoolListVM>(); vm.Searcher = searcher; return(vm.GetJson()); }
public IActionResult ExportExcel(SchoolSearcher searcher) { var vm = Wtm.CreateVM <SchoolListVM>(); vm.Searcher = searcher; vm.SearcherMode = ListVMSearchModeEnum.Export; return(vm.GetExportData()); }
public IActionResult ExportExcel(SchoolSearcher searcher) { var vm = CreateVM <SchoolListVM>(); vm.Searcher = searcher; vm.SearcherMode = ListVMSearchModeEnum.Export; var data = vm.GenerateExcel(); return(File(data, "application/vnd.ms-excel", $"Export_School_{DateTime.Now.ToString("yyyy-MM-dd")}.xls")); }
public IActionResult Search(SchoolSearcher searcher) { if (ModelState.IsValid) { var vm = Wtm.CreateVM <SchoolListVM>(); vm.Searcher = searcher; return(Content(vm.GetJson(enumToString: false))); } else { return(BadRequest(ModelState.GetErrorJson())); } }
public Task <JsonResult> OnPostGetName(string count, string page, string name) { if (!int.TryParse(count, out int HowMany)) { return(Task.FromResult(new JsonResult(new { error = "Error" }))); //TODO: Make errors more debug friendly } if (!int.TryParse(page, out int WhatPage)) { return(Task.FromResult(new JsonResult(new { error = "Error" }))); //TODO: Make errors more debug friendly } ISearcher <Tenant> search = new SchoolSearcher(configuration, ref HowMany, ref WhatPage, ref name); search.Search(); var temp_list = new List <object>(); foreach (Tenant x in search.Result) { temp_list.Add(new { x.OfficialName, x.Tag }); } return(Task.FromResult(new JsonResult(new { schools = temp_list, allin = search.MaximumInQueue }))); }