コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CandidateStudent candidateStudent = db.CandidateStudents.Find(id);

            db.CandidateStudents.Remove(candidateStudent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ID,Name,Major,Description,DateofBirth,PlaceofBirth,Address,PhoneNumber,YearsAttend")] CandidateStudent candidateStudent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(candidateStudent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(candidateStudent));
 }
コード例 #3
0
        // GET: CandidateStudents/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CandidateStudent candidateStudent = db.CandidateStudents.Find(id);

            if (candidateStudent == null)
            {
                return(HttpNotFound());
            }
            return(View(candidateStudent));
        }