예제 #1
0
        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());
        }
예제 #2
0
        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));
        }
예제 #3
0
 public MovieMapperProfile()
 {
     CreateMap <MovieDTO, MovieEntity>()
     .ConstructUsing(x => new MovieEntity(string.IsNullOrEmpty(x.Id) ? MovieId.New : MovieId.With(x.Id)));
 }