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"); }
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"); }
/// <summary> /// Deprecated Method for adding a new object to the subjects EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTosubjects(subject subject) { base.AddObject("subjects", subject); }
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"); }
/// <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; }