Ejemplo n.º 1
0
        public IActionResult Edit(int id)
        {
            //get the product by id
            Student p = StudentDb.GetStudent(context, id);

            //show it on web page
            return(View(p));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Update(int id)
        {
            //get the product by id
            Student p = await StudentDb.GetStudent(context, id);

            //show it on web page
            return(View(p));
        }
Ejemplo n.º 3
0
        //The details IActionResult was missing from the original project.
        public IActionResult Details(int id)
        {
            //This view is readonly.
            //Get the student to be displayed on the page
            Student s = StudentDb.GetStudent(context, id);

            return(View(s));
        }
Ejemplo n.º 4
0
        public IActionResult Edit(int id)
        {
            //get the student by id
            Student s = StudentDb.GetStudent(context, id);

            //show the student on the web page
            return(View(s));
        }
        public async Task <IActionResult> DeleteConfirm(int id)
        {
            //Get Product from database
            Student p = await StudentDb.GetStudent(context, id);

            await StudentDb.Delete(context, p);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        public IActionResult Delete(int id)
        {
            //Get Product from database
            Student p = StudentDb.GetStudent(context, id);

            StudentDb.Delete(context, p);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 7
0
        public IActionResult DeleteConfirm(int id)
        {
            //Get the student to be deleted from the database.
            Student s = StudentDb.GetStudent(context, id);

            //Delete the student from the Database.
            StudentDb.Delete(context, s);

            return(RedirectToAction("Students"));
        }
Ejemplo n.º 8
0
        public IActionResult DeleteConfirm(int id)
        {
            //Get Product from database
            Student p = StudentDb.GetStudent(context, id);

            StudentDb.Delete(context, p);

            context.Students.Remove(p);

            context.SaveChanges();

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> DeleteConfirm(int id)
        {
            //Get Product from database
            Student p = await StudentDb.GetStudent(context, id);

            context.Entry(p).State = EntityState.Deleted;

            await context.SaveChangesAsync();

            TempData["Message"] = $"{p.Name} was deleted";

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> Delete(int id)
        {
            Student p = await StudentDb.GetStudent(context, id);

            return(View(p));
        }
Ejemplo n.º 11
0
        public IActionResult Delete(int id)
        {
            Student p = StudentDb.GetStudent(context, id);

            return(View(p));
        }
        public async Task <IActionResult> Details(int id)
        {
            Student stu = await StudentDb.GetStudent(context, id);

            return(View(stu));
        }