public ActionResult AddScholarship(Scholar obj) { try { string message; DB49Entities k = new DB49Entities(); List <Student> students = k.Students.ToList(); ViewBag.StudentList = new SelectList(students, "StudentID", "Name"); List <Scholarshipss> scholarships = k.Scholarshipsses.ToList(); ViewBag.ScholarshipList = new SelectList(scholarships, "ScholarshipID", "Scholarship"); Student s = new Student(); Scholarshipss t = new Scholarshipss(); Scholar d = new Scholar(); d.StudentID = obj.StudentID; d.ScholarshipID = obj.ScholarshipID; d.ScholarID = obj.ScholarID; k.Scholars.Add(d); k.SaveChanges(); } catch (DbEntityValidationException e) { Console.WriteLine(e.ToString()); } return(View(obj)); }
public ActionResult UpdateFee(Fe obj) { try { DB49Entities k = new DB49Entities(); List <Student> students = k.Students.ToList(); ViewBag.StudentList = new SelectList(students, "StudentID", "Name"); List <Scholarshipss> scholarships = k.Scholarshipsses.ToList(); ViewBag.ScholarshipList = new SelectList(scholarships, "ScholarshipID", "Scholarship"); List <Lookup> lookups = k.Lookups.ToList(); ViewBag.LookupList = new SelectList(lookups, "LookupID", "Name"); Student s = new Student(); Scholarshipss t = new Scholarshipss(); Lookup p = new Lookup(); Fe d = new Fe(); d.StudentID = obj.StudentID; d.ScholarshipID = obj.ScholarshipID; d.LookupID = obj.LookupID; d.LookupID = obj.LookupID; d.NewFee = obj.NewFee; k.Fes.Add(d); k.SaveChanges(); var m = k.Fes.Where(n => n.StudentID == obj.StudentID).ToList(); foreach (var item in m) { // var k = db.Students.Select(new Student { EmailId = l.Email }).ToList(); if (item != null) { Session["FeeID"] = d.FeeID.ToString(); Session["ScholarshipID"] = d.ScholarshipID.ToString(); Session["LookupID"] = d.LookupID.ToString(); Session["NewFee"] = d.NewFee.ToString(); Session["StudentID"] = d.StudentID.ToString(); return(RedirectToAction("UpFeeChallan", "Student")); // message = " Course Registered Successfully.\\nRegisteredCourse Id:" + r.RegisteredCourseID.ToString(); //ViewBag.Message = message; } } } catch (DbEntityValidationException e) { Console.WriteLine(e.ToString()); } return(View(obj)); }