コード例 #1
0
        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));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(string id)
        {
            StudyTerm studyTerm = db.StudyTerms.Find(id);

            db.StudyTerms.Remove(studyTerm);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            StudyTerm studyTerm = await db.StudyTerms.FindAsync(id);

            db.StudyTerms.Remove(studyTerm);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #4
0
 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));
 }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        // 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));
        }
コード例 #8
0
        // 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));
        }