public ActionResult EditRegistartion(int id) ////get edit from bal { /**View Bag for Drop down list**/ StudentBAL stubal = new StudentBAL(); CourseBal courseBal = new CourseBal(); ViewBag.Courses = courseBal.GetCourse(); ViewBag.Students = stubal.Get_All_Student(); /////////////////////////////////////////////////// RegistrationBal reg = new RegistrationBal(); var result = reg.edit_enrollment(id).Select(r => new Register { EnrollmentID = r.EnrollmentID, StudentID = r.StudentID, StudentName = r.StudentName, CourseName = r.CourseName, RegisterDate = r.RegisterDate, StudentFees = r.StudentFees, CourseID = r.CourseID }).Single(s => s.EnrollmentID == id); return(View(result)); }
public ActionResult Add_NewRegistration() { StudentBAL stu = new StudentBAL(); CourseBal courseBal = new CourseBal(); ViewBag.Courses = courseBal.GetCourse(); ViewBag.Students = stu.Get_All_Student(); return(View()); }
public ActionResult EditRegistartion(Register r, int id) { if (ModelState.IsValid) { StudentBAL stu = new StudentBAL(); CourseBal courseBal = new CourseBal(); RegistrationBal bal = new RegistrationBal(); DateTime now = DateTime.Now; string reg = now.ToString(); double fees; if (r.CourseID == 1) { fees = 20; } else if (r.CourseID == 2) { fees = 40; } else { fees = 60; } if (bal.Check_user_input(r.StudentID, r.CourseID)) { bal.Update_Registered_Student(r.EnrollmentID, r.StudentID, r.CourseID, reg, fees); return(RedirectToAction("RegistrationList")); } else { r.EnrollmentID = id; ViewBag.Courses = courseBal.GetCourse(); ModelState.AddModelError("CourseID", SiteResource.ExistsRegistered); } } return(View(r)); }