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); }
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); }
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)); } }
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)); }