示例#1
0
        public IActionResult Update(ActorUpdateModel actorUpdateModel)
        {
            Actor actor = _mapper.Map <Actor>(actorUpdateModel);
            ActorResponseModel actorresponse = _mapper.Map <ActorResponseModel>(_actorRepository.Update(actor));

            return(Ok(actorresponse));
        }
 public Actor Edit(Actor entity, ActorUpdateModel model)
 {
     entity.ActorName   = model.Name;
     entity.Description = model.Description;
     entity.Phone       = model.Phone;
     entity.Email       = model.Email;
     entity.ImageActor  = model.Image;
     return(entity);
 }
示例#3
0
        public Actor Update(string id, ActorUpdateModel model)
        {
            var repo  = uow.GetService <IActorRepository>();
            var actor = repo.Get().Where(s => s.ActorId == id).FirstOrDefault();

            if (actor != null)
            {
                var updatedActor = repo.Edit(actor, model);
                return(repo.Update(updatedActor).Entity);
            }
            return(null);
        }
示例#4
0
 public IActionResult Update([FromQuery] string id, [FromBody] ActorUpdateModel model)
 {
     try
     {
         Actor updated = _uow.GetService <ActorDomain>().Update(id, model);
         if (updated != null)
         {
             _uow.SaveChanges();
             return(Success(updated.ActorId));
         }
         return(BadRequest());
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
示例#5
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));
        }