コード例 #1
0
        public IActionResult RemoveCake(int id)
        {
            var cake = cakeRepository.Get(id);

            if (cake == null || cake.IsDeleted == true)
            {
                return(RedirectToAction("Error"));
            }
            cakeRepository.Remove(id);
            return(RedirectToAction("Category", "Home", new { id = cake.CategoryId }));
        }
コード例 #2
0
        public bool Remove(int id)
        {
            Cake cake = Find(id);

            if (cake == null)
            {
                return(false);
            }

            return(_cakeRepository.Remove(cake));
        }