public ActionResult Select() { string mode = Request.QueryString["Grid-mode"]; if (!string.IsNullOrEmpty(mode)) { return(this.RedirectToAction("Create")); } else { List <AcademicYearVM> viewModels = new List <AcademicYearVM>(); AcademicYearBAL balObject = new AcademicYearBAL(); IQueryable <Entities.AcademicYear> entites = balObject.GetAll(); foreach (Entities.AcademicYear entity in entites) { AcademicYearVM viewModel = new AcademicYearVM(); viewModel.AcademicYearId = entity.AcademicYearId; viewModel.AcademicYearName = entity.AcademicYearName; viewModel.StartDate = entity.StartDate; viewModel.EndDate = entity.EndDate; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(this.View("Index", new GridModel <AcademicYearVM> { Data = viewModels })); } }
public ActionResult Index() { List <AcademicYearVM> viewModels = new List <AcademicYearVM>(); AcademicYearBAL balObject = new AcademicYearBAL(); IQueryable <Entities.AcademicYear> entites = balObject.GetAll(); foreach (Entities.AcademicYear entity in entites) { AcademicYearVM viewModel = new AcademicYearVM(); viewModel.AcademicYearId = entity.AcademicYearId; viewModel.AcademicYearName = entity.AcademicYearName; viewModel.StartDate = entity.StartDate; viewModel.EndDate = entity.EndDate; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(View(new GridModel <AcademicYearVM> { Data = viewModels })); }