コード例 #1
0
 public ActionResult SubjectEdit(int id, subject obj)
 {
     if (Session["id"] == null)
         return RedirectToAction("signin", "Home");
     subject objj = (from exm in db.subjects where exm.subjectId == id select exm).FirstOrDefault<subject>();
     objj.subjectName = obj.subjectName;
     db.SaveChanges();
     return RedirectToAction("SubjectIndex");
 }
コード例 #2
0
 public ActionResult SubjectDelete(int id, subject obj)
 {
     if (Session["id"] == null)
         return RedirectToAction("signin", "Home");
     subject sb = (from sub in db.subjects where sub.subjectId == id select sub).FirstOrDefault<subject>();
     db.subjects.DeleteObject(sb);
     db.SaveChanges();
     return RedirectToAction("SubjectIndex");
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the subjects EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTosubjects(subject subject)
 {
     base.AddObject("subjects", subject);
 }
コード例 #4
0
 public ActionResult SubjectCreate(subject obj)
 {
     if (Session["id"] == null)
         return RedirectToAction("signin", "Home");
     try
     {
         db.subjects.AddObject(obj);
         db.SaveChanges();
     }
     catch (Exception E)
     {
         Console.WriteLine(E);
     }
     return RedirectToAction("SubjectIndex");
 }
コード例 #5
0
 /// <summary>
 /// Create a new subject object.
 /// </summary>
 /// <param name="subjectId">Initial value of the subjectId property.</param>
 /// <param name="subjectName">Initial value of the subjectName property.</param>
 public static subject Createsubject(global::System.Int32 subjectId, global::System.String subjectName)
 {
     subject subject = new subject();
     subject.subjectId = subjectId;
     subject.subjectName = subjectName;
     return subject;
 }