public async Task <AlbumOutputDto> Create(AlbumInputDto dto) { var album = this.mapper.Map <Domain.Album.Album>(dto); await this.albumRepository.Save(album); return(this.mapper.Map <AlbumOutputDto>(album)); }
public async Task <IActionResult> SaveAlbuns(AlbumRequest request) { if (ModelState.IsValid == false) { return(BadRequest(ModelState)); } AlbumInputDto album = this.Mapper.Map <AlbumInputDto>(request); var query = await this.Mediator.Send(new CreateAlbumCommand(album)); var result = this.Mapper.Map <AlbumResponse>(query.Album); return(Created($"/{result.Id}", result)); }
public CreateAlbumCommand(AlbumInputDto album) { Album = album; }