Esempio n. 1
0
        public async Task <IActionResult> Delete([FromForm] int id, string name)
        {
            if (name.ToLower() == "default")
            {
                return(RedirectToAction("AllCards"));
            }

            CardsCollection cardsVM = await _cardsService.GetCardsById(id);

            if (cardsVM != null)
            {
                Task <bool> result = _crudCardsService.DeleteAsync(cardsVM);

                if (result.Result == true)
                {
                    return(RedirectToAction("AllCards"));
                }
                else
                {
                    ModelState.AddModelError("", "Collection Not Delete");
                }
            }
            else
            {
                ModelState.AddModelError("", "Collection Not Found");
            }
            return(View("AllCards"));
        }