Пример #1
0
        public string Search(SchoolSearcher searcher)
        {
            var vm = CreateVM <SchoolListVM>();

            vm.Searcher = searcher;
            return(vm.GetJson());
        }
Пример #2
0
        public IActionResult ExportExcel(SchoolSearcher searcher)
        {
            var vm = Wtm.CreateVM <SchoolListVM>();

            vm.Searcher     = searcher;
            vm.SearcherMode = ListVMSearchModeEnum.Export;
            return(vm.GetExportData());
        }
Пример #3
0
        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"));
        }
Пример #4
0
 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()));
     }
 }
Пример #5
0
        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 })));
        }