示例#1
0
        public IActionResult Update(Actor actor)
        {
            if (!ModelState.IsValid)
            {
                return(View(actor));
            }

            _actorRepository.Update(actor);

            return(RedirectToAction("List"));
        }
示例#2
0
        public async Task <IActionResult> Update([FromForm] ActorUpdateModel actorModel)
        {
            var model = await _actorRepo.GetActor(actorModel.Id);

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

            var actor = new Actor {
                Id           = actorModel.Id,
                ActorName    = actorModel.ActorName,
                ActorPicture = actorModel.ActorPicture
            };

            await _actorRepo.Update(actor);

            return(Ok(actor));
        }