public ActionResult Create(StudentActivity studentactivity, string opener_id = null)
 {
     if (ModelState.IsValid)
     {
         db.StudentActivities.Add(studentactivity);
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             return HttpNotFound("Failed to add activity record.<br/><br/>" + e.Message);
         }
     }
     return RedirectToAction("ActivityRecord", "StudentProfile", new { student_id = studentactivity.student_id, opener_id = opener_id });
 }
 public ActionResult Create(string student_id = null, string opener_id = null)
 {
     ViewBag.opener_id = opener_id;
     var student = db.StudentProfiles.Find(student_id);
     if (student == null)
     {
         return HttpNotFound("Student Profile not found.");
     }
     StudentActivity studentactivity = new StudentActivity
     {
         start_date = DateTime.Now,
         end_date = DateTime.Now,
         student_id = student.id,
         StudentProfile = student
     };
     return View(studentactivity);
 }
 public ActionResult Edit(StudentActivity studentactivity, string opener_id = null)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studentactivity).State = EntityState.Modified;
         db.SaveChanges();
     }
     return RedirectToAction("ActivityRecord", "StudentProfile", new { student_id = studentactivity.student_id, opener_id = opener_id });
 }