public ActionResult Select() { string mode = Request.QueryString["Grid-mode"]; if (!string.IsNullOrEmpty(mode)) { return(this.RedirectToAction("Create")); } else { List <ClassDivisionVM> viewModels = new List <ClassDivisionVM>(); ClassDivisionBAL balObject = new ClassDivisionBAL(); IQueryable <Entities.ClassDivision> entites = balObject.GetAll(); foreach (Entities.ClassDivision entity in entites) { ClassDivisionVM viewModel = new ClassDivisionVM(); viewModel.ClassDivisionId = entity.ClassDivisionId; viewModel.ClassId = entity.ClassId; viewModel.DivisionId = entity.DivisionId; viewModel.ClassName = entity.ClassName; viewModel.DivisionName = entity.DivisionName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(this.View("Index", new GridModel <ClassDivisionVM> { Data = viewModels })); } }
public ActionResult Index() { List <ClassDivisionVM> viewModels = new List <ClassDivisionVM>(); ClassDivisionBAL balObject = new ClassDivisionBAL(); IQueryable <Entities.ClassDivision> entites = balObject.GetAll(); foreach (Entities.ClassDivision entity in entites) { ClassDivisionVM viewModel = new ClassDivisionVM(); viewModel.ClassDivisionId = entity.ClassDivisionId; viewModel.ClassId = entity.ClassId; viewModel.DivisionId = entity.DivisionId; viewModel.ClassName = entity.ClassName; viewModel.DivisionName = entity.DivisionName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(View(new GridModel <ClassDivisionVM> { Data = viewModels })); }