public ActionResult ExamCreate(exam obj) { if (Session["id"] == null) return RedirectToAction("signin", "Home"); try { db.exams.AddObject(obj); db.SaveChanges(); } catch (Exception E) { Console.WriteLine(E); } return RedirectToAction("ExamIndex"); }
/// <summary> /// Deprecated Method for adding a new object to the exams EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToexams(exam exam) { base.AddObject("exams", exam); }
public ActionResult ExamEdit(int id, exam obj) { if (Session["id"] == null) return RedirectToAction("signin", "Home"); exam objj = (from exm in db.exams where exm.examId == id select exm).FirstOrDefault<exam>(); objj.examName = obj.examName; db.SaveChanges(); return RedirectToAction("ResultIndex"); }
/// <summary> /// Create a new exam object. /// </summary> /// <param name="examId">Initial value of the examId property.</param> /// <param name="examName">Initial value of the examName property.</param> public static exam Createexam(global::System.Int32 examId, global::System.String examName) { exam exam = new exam(); exam.examId = examId; exam.examName = examName; return exam; }