public ActionResult Create(StudentParticular studentparticular) { if (ModelState.IsValid) { db.StudentParticulars.Add(studentparticular); try { db.SaveChanges(); } catch (Exception e) { return HttpNotFound("Failed to add particular.<br/><br/>" + e.Message); } } return RedirectToAction("MyParticular", "StudentProfile", new { student_id = studentparticular.student_id }); }
public ActionResult Create(int id = 0) { var type = db.StudentParticularTypes.Find(id); var student = db.StudentProfiles.Find(User.Identity.Name); if (student == null || type == null) { return HttpNotFound("Student Profile or Particular Type not found."); } StudentParticular particular = new StudentParticular { type_id = id, student_id = student.id, StudentProfile = student, StudentParticularType = type }; return View(particular); }
public ActionResult Edit(StudentParticular studentparticular) { if (ModelState.IsValid) { db.Entry(studentparticular).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(studentparticular); }