public ActionResult DeleteConfirmed(int id)
        {
            StudentOld student = db.Students.Find(id);

            db.Students.Remove(student);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            StudentOld student = await db.Students.FindAsync(id);

            db.Students.Remove(student);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public ActionResult Create([Bind(Include = "id,FirstName,LastName,EmailAddress,PhoneNumber")] StudentOld student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(student));
        }
Beispiel #4
0
        public async Task <ActionResult> Edit([Bind(Include = "id,FirstName,LastName,EmailAddress,PhoneNumber")] StudentOld student)
        {
            if (ModelState.IsValid)
            {
                db.Entry(student).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(PartialView(student));
        }
        // GET: Students/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentOld student = db.Students.Find(id);

            if (student == null)
            {
                return(HttpNotFound());
            }
            return(View(student));
        }
Beispiel #6
0
        // GET: StudentsAjax/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentOld student = await db.Students.FindAsync(id);

            if (student == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(student));
        }