public async Task <IActionResult> UpdateMovie([FromBody] MovieDTO movie, CancellationToken cancellationToken) { await _commandBus.PublishAsync(new UpdateMovieCommand(MovieId.With(movie.Id), movie.Name, movie.Director, movie.Budget), cancellationToken); return(Ok()); }
public async Task <IActionResult> GetMovie(string Id, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(Id)) { return(BadRequest(nameof(NullReferenceException))); } var result = await _movieQueryService.GetMovieByIdAsync(MovieId.With(Guid.Parse(Id)), cancellationToken); return(new JsonResult(result)); }
public MovieMapperProfile() { CreateMap <MovieDTO, MovieEntity>() .ConstructUsing(x => new MovieEntity(string.IsNullOrEmpty(x.Id) ? MovieId.New : MovieId.With(x.Id))); }