예제 #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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #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"));
        }
예제 #6
0
        public IActionResult Delete(int id)
        {
            //Get Product from database
            Student p = StudentDb.GetStudent(context, id);

            StudentDb.Delete(context, p);

            return(RedirectToAction("Index"));
        }
예제 #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"));
        }
예제 #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"));
        }
예제 #10
0
        public async Task <IActionResult> Delete(int id)
        {
            Student p = await StudentDb.GetStudent(context, id);

            return(View(p));
        }
예제 #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));
        }