public ActionResult Update(N5動詞_Table model) { try { //model.第課ID = int.Parse(Request.Form["第課List"]); db.Entry(model).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ModelState.Clear(); ModelState.AddModelError("", "Update thành công!"); } catch { ModelState.AddModelError("", "Update thất bại!"); } ViewBag.グループList = new SelectList(db.グループ_Table, "グループID", "グループ"); ViewBag.GroupName = new SelectList(db.Group動詞, "GroupNameID", "GroupName", selectedValue: false); return(View("Index")); }
public ActionResult Insert(N5動詞_Table model) { try { //model.第課ID = int.Parse(Request.Form["第課List"]); db.N5動詞_Table.Add(model); db.SaveChanges(); ModelState.Clear(); ModelState.AddModelError("", "Thêm thành công!"); } catch { ModelState.AddModelError("", "Thêm thất bại!"); } ViewBag.グループList = new SelectList(db.グループ_Table, "グループID", "グループ"); ViewBag.GroupName = new SelectList(db.Group動詞, "GroupNameID", "GroupName", selectedValue: false); return(View("Index")); }