public ActionResult Edit([Bind(Include = "NoticeID,NoticeTitle,Content,AuthorName,PostTime,NoticeIsShow,PriorOrder,ClickCount")] Notice notice) { if (ModelState.IsValid) { db.Entry(notice).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(notice)); }
public ActionResult Edit([Bind(Include = "BookTypeID,BookTypeName")] BookType bookType) { if (ModelState.IsValid) { db.Entry(bookType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bookType)); }
public ActionResult Edit([Bind(Include = "BookID,BookName,ISBN,AuthorName,Press,PublishingDate,Price,BookTypeID")] Book book) { if (ModelState.IsValid) { db.Entry(book).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BookTypeID = new SelectList(db.BookTypes, "BookTypeID", "BookTypeName", book.BookTypeID); return(View(book)); }
public ActionResult Edit([Bind(Include = "DepartmentID,DepartmentName,DepartmentLocation")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; db.SaveChanges(); if (Request.UrlReferrer != null) { var returnUrl = Request.UrlReferrer.ToString(); return(new RedirectResult(returnUrl)); //由于使用的是表单提交而非Ajax无刷新异步提交。所以使用jquery将表单提交到控制器后,返回Request.UrlReferrer返回到上一个页面将是数据库更新后的状态,筛选、排序、分页都保持不变。 } return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Edit([Bind(Include = "GradeMajorID,GradeID,MajorID,GradeMajorIsValidate")] GradeMajor gradeMajor) { if (ModelState.IsValid) { db.Entry(gradeMajor).State = EntityState.Modified; db.SaveChanges(); if (Request.UrlReferrer != null) { var returnUrl = Request.UrlReferrer.ToString(); return(new RedirectResult(returnUrl)); //由于使用的是隐藏表单提交而非Ajax无刷新异步提交。所以使用jquery将表单提交到控制器后,返回Request.UrlReferrer返回到上一个页面将是数据库更新后的状态。 } return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SemesterID,SemesterName,StartDateOfSubscription,OverDateOfSubscription,SwitchOfSubscription,IsCurrentSemester")] Semester semester) { if (ModelState.IsValid) { db.Entry(semester).State = EntityState.Modified; db.SaveChanges(); if (Request.UrlReferrer != null) { var returnUrl = Request.UrlReferrer.ToString(); return(new RedirectResult(returnUrl)); //由于使用的是表单提交而非Ajax无刷新异步提交。所以使用jquery将表单提交到控制器后,返回Request.UrlReferrer返回到上一个页面将是数据库更新后的状态,筛选、排序、分页都保持不变。 } return(RedirectToAction("Index")); } return(View(semester)); }
public ActionResult Edit([Bind(Include = "MajorID,MajorName,DepartmentID")] Major major) { if (ModelState.IsValid) { db.Entry(major).State = EntityState.Modified; db.SaveChanges(); // ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "DepartmentName", major.DepartmentID); //return View(major); if (Request.UrlReferrer != null) { var returnUrl = Request.UrlReferrer.ToString(); return(new RedirectResult(returnUrl)); //由于使用的是隐藏表单提交而非Ajax无刷新异步提交。所以使用jquery将表单提交到控制器后,返回Request.UrlReferrer返回到上一个页面将是数据库更新后的状态。 } return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SchoolClassID,SchoolClassName,StudentNumber")] SchoolClass schoolClass, int GradeID, int MajorID) { if (ModelState.IsValid) { var gradeMajor = db.GradeMajors.SingleOrDefault(x => x.GradeID == GradeID && x.MajorID == MajorID); if (gradeMajor == null) { return(HttpNotFound()); } schoolClass.GradeMajorID = gradeMajor.GradeMajorID; db.Entry(schoolClass).State = EntityState.Modified; db.SaveChanges(); if (Request.UrlReferrer != null) { var returnUrl = Request.UrlReferrer.ToString(); return(new RedirectResult(returnUrl)); //由于使用的是隐藏表单提交而非Ajax无刷新异步提交。所以使用jquery将表单提交到控制器后,返回Request.UrlReferrer返回到上一个页面将是数据库更新后的状态。 } return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SemesterCourseID,SemesterID,SemesterCourseNumber,SemesterCourseName,CourseType")] SemesterCourse semesterCourse, int GradeID, int MajorID) { if (ModelState.IsValid) { var gradeMajor = db.GradeMajors.SingleOrDefault(x => x.GradeID == GradeID && x.MajorID == MajorID); if (gradeMajor == null || gradeMajor.GradeMajorIsValidate == false) { return(HttpNotFound()); } semesterCourse.GradeMajorID = gradeMajor.GradeMajorID; semesterCourse.AuthorName = User.Identity.GetUserName(); semesterCourse.PostTime = DateTime.Now; db.Entry(semesterCourse).State = EntityState.Modified; db.SaveChanges(); if (Request.UrlReferrer != null) { var returnUrl = Request.UrlReferrer.ToString(); return(new RedirectResult(returnUrl)); //由于使用的是隐藏表单提交而非Ajax无刷新异步提交。所以使用jquery将表单提交到控制器后,返回Request.UrlReferrer返回到上一个页面将是数据库更新后的状态。 } return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }