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));
        }