public ActionResult AddSoftCourse(FormCollection form) { string[] keys = form.AllKeys; if (form["CourseName&1"] != "" && form["CourseName&1"] != null) { for (int i = 1; i <= 20; i++)//默认只能有二十门课程 { if (keys.Contains<string>("CourseName&" + i)) { Tb_SoftCourse softCourse = new Tb_SoftCourse() { CourseName = form["CourseName&" + i], SoftPlatform = form["SoftPlatform&" + i], StuNum = int.Parse(form["StuNum&" + i].ToString()), ApplyID = int.Parse(Session["ApplyID"].ToString()) }; db.Tb_SoftCourse.Add(softCourse); } } db.SaveChanges(); return RedirectToAction("ApplySuccess"); //return View("ApplySuccess"); } else { return View(); } }
public ActionResult AddSoftCourse(FormCollection form) { string[] keys = form.AllKeys; if (form["CourseName&1"] != "" && form["CourseName&1"] != null) { for (int i = 1; i <= 20; i++)//默认只能有二十门课程 { if (keys.Contains <string>("CourseName&" + i)) { Tb_SoftCourse softCourse = new Tb_SoftCourse() { CourseName = form["CourseName&" + i], SoftPlatform = form["SoftPlatform&" + i], StuNum = int.Parse(form["StuNum&" + i].ToString()), ApplyID = int.Parse(Session["ApplyID"].ToString()) }; db.Tb_SoftCourse.Add(softCourse); } } db.SaveChanges(); return(RedirectToAction("ApplySuccess")); //return View("ApplySuccess"); } else { return(View()); } }
public ActionResult DeleteSoftCourse(int id) { Tb_SoftCourse tb_softcourse = db.Tb_SoftCourse.Find(id); db.Tb_SoftCourse.Remove(tb_softcourse); db.SaveChanges(); return(RedirectToAction("SoftCourseList", new { id = tb_softcourse.ApplyID })); }
public ActionResult DeleteConfirmed(int id) { Tb_SoftCourse tb_softcourse = db.Tb_SoftCourse.Find(id); db.Tb_SoftCourse.Remove(tb_softcourse); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult EditSoftCourse(Tb_SoftCourse tb_softcourse) { if (ModelState.IsValid) { db.Entry(tb_softcourse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("SoftCourseList", new { id = tb_softcourse.ApplyID })); } return(View(tb_softcourse)); }
// // GET: /Default1/Edit/5 public ActionResult EditSoftCourse(int id = 0) { Tb_SoftCourse tb_softcourse = db.Tb_SoftCourse.Find(id); if (tb_softcourse == null) { return(HttpNotFound()); } return(View(tb_softcourse)); }
public ActionResult Edit(Tb_SoftCourse tb_softcourse) { if (ModelState.IsValid) { db.Entry(tb_softcourse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tb_softcourse)); }
public ActionResult CreateSoftCourse(Tb_SoftCourse tb_softcourse) { if (ModelState.IsValid) { db.Tb_SoftCourse.Add(tb_softcourse); db.SaveChanges(); return(RedirectToAction("SoftCourseList", new { id = tb_softcourse.ApplyID })); } return(View(tb_softcourse)); }
public ActionResult Create(Tb_SoftCourse tb_softcourse) { if (ModelState.IsValid) { db.Tb_SoftCourse.Add(tb_softcourse); db.SaveChanges(); return RedirectToAction("Index"); } return View(tb_softcourse); }
public ActionResult Create(Tb_SoftCourse tb_softcourse) { if (ModelState.IsValid) { db.Tb_SoftCourse.Add(tb_softcourse); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tb_softcourse)); }
public ActionResult Edit(Tb_SoftCourse tb_softcourse) { if (ModelState.IsValid) { db.Entry(tb_softcourse).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(tb_softcourse); }
public ActionResult EditSoftCourse(Tb_SoftCourse tb_softcourse) { if (ModelState.IsValid) { db.Entry(tb_softcourse).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("SoftCourseList", new { id = tb_softcourse.ApplyID }); } return View(tb_softcourse); }
public ActionResult CreateSoftCourse(Tb_SoftCourse tb_softcourse) { if (ModelState.IsValid) { db.Tb_SoftCourse.Add(tb_softcourse); db.SaveChanges(); return RedirectToAction("SoftCourseList", new { id = tb_softcourse.ApplyID }); } return View(tb_softcourse); }