public ActionResult CreateGroup(StudyGroup group) { try { StudyGroup sg = new StudyGroup(); sg.Title = group.Title; sg.TeacherId = group.TeacherId; db.StudyGroup.Add(sg); db.SaveChanges(); return RedirectToAction("CreateGroup"); } catch { return View(); } }
public ActionResult EditStudyGroup(int id, StudyGroup obj) { var esg = db.StudyGroup; StudyGroup old = esg.SingleOrDefault(sg => sg.Id == id); old.Title = obj.Title; db.SaveChanges(); return RedirectToAction("StudyGroup"); }
public ActionResult CreateGroup(StudyGroup studygroup, int List) { try { StudyGroup sgTable = new StudyGroup(); sgTable.Title = studygroup.Title; sgTable.TeacherId = List; db.StudyGroup.Add(sgTable); db.SaveChanges(); return RedirectToAction("StudyGroup"); } catch { return View(); } }