public IActionResult DeleteFlower(int id) { Flower flower = _flowerRepository.GetFlowerById(id); if (flower != null) { _flowerRepository.DeleteFlower(flower); return(View(FManagement, _flowerRepository.FlowersAsViewModel)); } else { ModelState.AddModelError("", "This flower can't be found."); } return(View(FManagement, _flowerRepository.FlowersAsViewModel)); }
public ActionResult DeleteConfirmed(int id) { flowerRepository.DeleteFlower(id); return(RedirectToAction("Index")); }