public IActionResult Edit(int id) { //get the product by id Student p = StudentDb.GetStudent(context, id); //show it on web page return(View(p)); }
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)); }
//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)); }
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")); }
public IActionResult Delete(int id) { //Get Product from database Student p = StudentDb.GetStudent(context, id); StudentDb.Delete(context, p); return(RedirectToAction("Index")); }
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")); }
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")); }
public async Task <IActionResult> Delete(int id) { Student p = await StudentDb.GetStudent(context, id); return(View(p)); }
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)); }