public async Task <ActionResult> Put(int id, [FromForm] ActorAddDTO actorAddDTO) { var actor = await context.Actors.FirstOrDefaultAsync(x => x.id == id); if (actor == null) { return(NotFound()); } actor = mapper.Map(actorAddDTO, actor); if (actorAddDTO.Photo != null) { actor.Photo = await storageFile.EditFiles(container, actorAddDTO.Photo, actor.Photo); } await context.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult> Put(int id, [FromForm] MovieAddDTO movieAddDTO) { var movie = await context.Movies .Include(ma => ma.moviesActors) .Include(mg => mg.moviesGenres) .Include(mt => mt.moviesTheaters) .FirstOrDefaultAsync(x => x.id == id); if (movie == null) { return(NotFound()); } movie = mapper.Map(movieAddDTO, movie); if (movieAddDTO.Img != null) { movie.Img = await storageFile.EditFiles(container, movieAddDTO.Img, movie.Img); } WriteActorsByOrder(movie); await context.SaveChangesAsync(); return(NoContent()); }