示例#1
0
        public async Task <IActionResult> Add([Bind("Name,Birthday,Birthplace,Bio")] Actor actor)
        {
            if (ModelState.IsValid)
            {
                Actor foundActor = await _actors.GetByName(actor.Name);

                if (foundActor == null)
                {
                    _actors.Add(actor);
                    ModelState.Clear();
                    ViewBag.UserMessage = "Actor Added";
                    return(RedirectToAction($"Detail/{actor.Id}"));
                }
            }

            return(NotFound());
        }