コード例 #1
0
        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));
        }
コード例 #2
0
 public ActionResult DeleteConfirmed(int id)
 {
     flowerRepository.DeleteFlower(id);
     return(RedirectToAction("Index"));
 }