public ActionResult Create(int id, student s)
        {
            if (Session["id"] == null)
                return RedirectToAction("signin", "Home");
                //try
                //{
                // TODO: Add insert logic here
            if (s.EducationMedium.Equals("English Medium"))
            {
                s.StudentFee = (from sfee in DAO.classes where sfee.classId == s.classId select sfee.classFee).First();
            }
            else
            {
                s.StudentFee = (from sfee in DAO.classes where sfee.classId == s.classId select sfee.classFeeU).First();
            }
                DAO.students.AddObject(s);
                DAO.SaveChanges();

                return RedirectToAction("Index");
            //}
            //catch
            //{
            //    return View();
            //}
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the students EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTostudents(student student)
 {
     base.AddObject("students", student);
 }
 /// <summary>
 /// Create a new student object.
 /// </summary>
 /// <param name="studentId">Initial value of the studentId property.</param>
 public static student Createstudent(global::System.Int32 studentId)
 {
     student student = new student();
     student.studentId = studentId;
     return student;
 }
 public ActionResult ViewSection(int id, student std)
 {
     if (Session["id"] == null)
         return RedirectToAction("signin", "Home");
     try
     {
         csection = std.StudyClass.ToString();
         return RedirectToAction("ViewSectionResult");
     }
     catch (Exception E)
     {
         return RedirectToAction("ViewSection");
     }
 }
 public ActionResult ViewMedium(int id, student std)
 {
     if (Session["id"] == null)
         return RedirectToAction("signin", "Home");
     try
     {
         cmedium = std.EducationMedium.ToString();
         return RedirectToAction("ViewMediumResult");
     }
     catch (Exception E)
     {
         return RedirectToAction("ViewMedium");
     }
 }
 public ActionResult ViewGender(int id, student std)
 {
     if (Session["id"] == null)
         return RedirectToAction("signin", "Home");
     try
     {
         cgender = std.StudentGender.ToString();
         return RedirectToAction("ViewGenderResult");
     }
     catch(Exception E)
     {
         return RedirectToAction("ViewGender");
     }
 }
 public ActionResult ViewClass(int id, student std)
 {
     if (Session["id"] == null)
         return RedirectToAction("signin", "Home");
     try
     {
         cid = Convert.ToInt32(std.classId);
         return RedirectToAction("ViewClassResult");
     }
     catch (Exception E)
     {
         return RedirectToAction("ViewClass");
     }
 }
 public ActionResult ViewAll(int id, student std)
 {
     if (Session["id"] == null)
         return RedirectToAction("signin", "Home");
     try
     {
         cstatus = Convert.ToInt32(std.StudentStatus);
         return RedirectToAction("ViewAllResult");
     }
     catch (Exception E)
     {
         return RedirectToAction("ViewAll");
     }
 }
        public ActionResult EditStudent(int id, student std)
        {
            if (Session["id"] == null)
                return RedirectToAction("signin", "Home");
            student s = (from st in DAO.students where st.studentId == id select st).FirstOrDefault<student>();
            s.StudentStatus = std.StudentStatus;
            s.studentId = std.studentId;
            s.StudentName = std.StudentName;
            s.StudentRollNumber = std.StudentRollNumber;
            s.StudentFee = std.StudentFee;
            s.StudyClass = std.StudyClass;
            s.StudentAddress = std.StudentAddress;
            s.CellPhone = std.CellPhone;
            s.Telephone = std.Telephone;
            s.StudentGender = std.StudentGender;
            s.DateOfAdmission = std.DateOfAdmission;
            s.StudentDOB = std.StudentDOB;
            s.classId = std.classId;
            s.EducationMedium = std.EducationMedium;
            s.familyId = std.familyId;

            if (std.EducationMedium.Equals("English Medium"))
            {
                s.StudentFee = (from sfee in DAO.classes where sfee.classId == std.classId select sfee.classFee).First();
            }
            else
            {
                s.StudentFee = (from sfee in DAO.classes where sfee.classId == std.classId select sfee.classFeeU).First();
            }

            DAO.SaveChanges();
            return RedirectToAction("StudentViewMenu");
        }