public async Task <IActionResult> DeleteConfirmed(int id) /*change the method name, still posting to delete, just calling a different method, work around*/ { Clothing c = await ClothingDb.GetClothingById(id, _context); await ClothingDb.Delete(c, _context); TempData["Message"] = $"{c.Title} deleted successfully"; return(RedirectToAction(nameof(ShowAll))); }
public async Task <IActionResult> DeleteConfirmed(int id) { Clothing c = await ClothingDb.GetClothingByID(id, _context); await ClothingDb.Delete(c, _context); TempData["Msg"] = $"{c.Title} Deleted Successfully."; return(RedirectToAction(nameof(ShowAll))); }
[ActionName("Delete")] //workaround because we can't have two methods with the same parameters with the same name public async Task <IActionResult> DeleteConfirmed(int id) { Clothing c = await ClothingDb.GetClothingById(id, _context); await ClothingDb.Delete(c, _context); TempData["Message"] = $"{c.Title} deleted successfully"; return(RedirectToAction(nameof(ShowAll))); //turns "ShowAll" into a string }