public JsonResult GetMaster() { MasterService os = new MasterService(); MasterListViewModel result = os.GetAllMaster(); var datas = new { result.data }; return(Json(datas, JsonRequestBehavior.AllowGet)); }
public IActionResult Index(int page = 0, string group = null) { MasterListViewModel viewModel = new MasterListViewModel(); MasterListFilterInput filterInput = GetFilterInSession <MasterListFilterInput>(ConstantConfig.SessionName.MasterListSession); if (filterInput == null) { filterInput = new MasterListFilterInput { RecordStatus = ConstantConfig.RecordStatusConfig.Active }; } filterInput.Group = group; filterInput.PageNumber = page; viewModel.MainListResult = masterListAdminService.GetAllByPaging(filterInput); ViewData["group"] = group; viewModel.MasterListFilterInput = filterInput; InitAdminBaseViewModel(viewModel); return(View(viewModel)); }
public MasterListViewModel GetAllMaster() { MasterListViewModel result = new MasterListViewModel(); result.data = new List <MasterViewModel>(); DBModel context = new DBModel(); DbRepository <Master> repo = new DbRepository <Master>(context); foreach (var item in repo.GetAll().OrderBy((x) => x.master_id)) { MasterViewModel m = new MasterViewModel() { master_id = item.master_id, master_account = item.master_account, master_password = item.master_password, }; result.data.Add(m); } return(result); }