Beispiel #1
0
        public IActionResult DeleteActor(int?id)
        {
            var actor = actorManager.FindById((int)id);

            if (actor == null)
            {
                return(NotFound());
            }

            actorManager.DeleteActor((int)id);
            TempData["message"] = $"Se ha eliminado el actor '{actor.Name}' correctamente";
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(decimal id)
        {
            int result = _actorManager.DeleteActor(id);

            if (result == 0)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Actor is part of a movie cant delete");
                Actor actor = _actorManager.GetActors(id).FirstOrDefault();
                return(View(actor));
            }
        }