public async Task <IActionResult> Edit(int id, [Bind("TermId,TermName,TermStartDate,TermEndDate,TermYear,TermSeason")] StudyTerm studyTerm) { if (id != studyTerm.TermId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(studyTerm); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudyTermExists(studyTerm.TermId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(studyTerm)); }
public ActionResult DeleteConfirmed(string id) { StudyTerm studyTerm = db.StudyTerms.Find(id); db.StudyTerms.Remove(studyTerm); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(string id) { StudyTerm studyTerm = await db.StudyTerms.FindAsync(id); db.StudyTerms.Remove(studyTerm); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "TermID,TermName,TermStartDate,TermEndDate,TermYear,TermSeason")] StudyTerm studyTerm) { if (ModelState.IsValid) { db.Entry(studyTerm).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(studyTerm)); }
public ActionResult Create([Bind(Include = "TermID,TermName,TermStartDate,TermEndDate,TermYear,TermSeason")] StudyTerm studyTerm) { if (ModelState.IsValid) { db.StudyTerms.Add(studyTerm); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(studyTerm)); }
public async Task <IActionResult> Create([Bind("TermId,TermName,TermStartDate,TermEndDate,TermYear,TermSeason")] StudyTerm studyTerm) { if (ModelState.IsValid) { _context.Add(studyTerm); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(studyTerm)); }
// GET: StudyTerms/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudyTerm studyTerm = db.StudyTerms.Find(id); if (studyTerm == null) { return(HttpNotFound()); } return(View(studyTerm)); }
// GET: StudyTerms/Delete/5 public async Task <ActionResult> Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudyTerm studyTerm = await db.StudyTerms.FindAsync(id); if (studyTerm == null) { return(HttpNotFound()); } return(View(studyTerm)); }