public ActionResult StudentContact(StudentContact studentcontact) { var username = System.Web.HttpContext.Current.User.Identity.GetUserName(); var user = UserManipulation.GetUserInfo(username); if (ModelState.IsValid) { db.InsertContactRecord(studentcontact.StudentId, user.UserID, studentcontact.ContactedDate, studentcontact.ContactedMedium); db.SaveChanges(); return RedirectToAction("Index"); } return View(studentcontact); }
public ActionResult StudentContact(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Student student = db.Students.Find(id); StudentContact studentcontact = new StudentContact(); studentcontact.StudentId = id; if (student == null) { return HttpNotFound(); } return View(studentcontact); }