public ActionResult Select() { string mode = Request.QueryString["Grid-mode"]; if (!string.IsNullOrEmpty(mode)) { return(this.RedirectToAction("Create")); } else { List <FeeHeadVM> viewModels = new List <FeeHeadVM>(); FeeHeadBAL balObject = new FeeHeadBAL(); IQueryable <Entities.FeeHead> entites = balObject.GetAll(); foreach (Entities.FeeHead entity in entites) { FeeHeadVM viewModel = new FeeHeadVM(); viewModel.FeeHeadId = entity.FeeHeadId; viewModel.FeeHeadName = entity.FeeHeadName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(this.View("Index", new GridModel <FeeHeadVM> { Data = viewModels })); } }
public ActionResult Edit(FeeHeadVM viewModel) { try { // TODO: Add update logic here if (ModelState.IsValid) { Entities.FeeHead entity = new Entities.FeeHead(); entity.FeeHeadId = viewModel.FeeHeadId; entity.FeeHeadName = viewModel.FeeHeadName; entity.Status = viewModel.Status; entity.Remark = viewModel.Remark; FeeHeadBAL balObject = new FeeHeadBAL(); balObject.Edit(entity); return(RedirectToAction("Index")); } else { return(View(viewModel)); } } catch { return(View()); } }
public ActionResult Create(FeeHeadVM viewModel) { try { // TODO: Add insert logic here if (ModelState.IsValid) { Entities.FeeHead entity = new Entities.FeeHead(); entity.FeeHeadId = viewModel.FeeHeadId; entity.FeeHeadName = viewModel.FeeHeadName; entity.Status = viewModel.Status; entity.Remark = viewModel.Remark; FeeHeadBAL balObject = new FeeHeadBAL(); balObject.Add(entity); return(RedirectToAction("Index")); } else { //AcademicYearBAL academicYearBAL = new AcademicYearBAL(); // viewModel.AcademicYears = from obj in academicYearBAL.GetAll() select new SelectListItem() { Text = obj.AcademicYearName, Value = obj.AcademicYearId.ToString() }; return(View(viewModel)); } } catch { // AcademicYearBAL academicYearBAL = new AcademicYearBAL(); //viewModel.AcademicYears = from obj in academicYearBAL.GetAll() select new SelectListItem() { Text = obj.AcademicYearName, Value = obj.AcademicYearId.ToString() }; return(View(viewModel)); } }
// // GET: /SysAdmin/FeeHead/Create public ActionResult Create() { FeeHeadVM viewModel = new FeeHeadVM(); //AcademicYearBAL academicYearBAL = new AcademicYearBAL(); //viewModel.AcademicYears = from obj in academicYearBAL.GetAll() select new SelectListItem() { Text = obj.AcademicYearName, Value = obj.AcademicYearId.ToString() }; viewModel.Status = true; return(View(viewModel)); }
// // GET: /SysAdmin/FeeHead/Details/5 public ActionResult Details(int id) { FeeHeadVM viewModel = new FeeHeadVM(); FeeHeadBAL balObject = new FeeHeadBAL(); IQueryable <Entities.FeeHead> entites = balObject.FindBy(a => a.FeeHeadId == id); if (entites != null && entites.Count() > 0) { Entities.FeeHead entity = entites.FirstOrDefault(); viewModel.FeeHeadId = entity.FeeHeadId; viewModel.FeeHeadName = entity.FeeHeadName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; } return(View(viewModel)); }
public ActionResult Index() { List <FeeHeadVM> viewModels = new List <FeeHeadVM>(); FeeHeadBAL balObject = new FeeHeadBAL(); IQueryable <Entities.FeeHead> entites = balObject.GetAll(); foreach (Entities.FeeHead entity in entites) { FeeHeadVM viewModel = new FeeHeadVM(); viewModel.FeeHeadId = entity.FeeHeadId; viewModel.FeeHeadName = entity.FeeHeadName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(View(new GridModel <FeeHeadVM> { Data = viewModels })); }