public async Task <MusicResponse> Handle(CreateMusicCommand request, CancellationToken cancellationToken)
        {
            var newMusic = MusicMapper.Mapper.Map <Music.Domain.Entities.Music>(request);

            var create = await _musicRepository.AddAsync(newMusic);

            if (create != null)
            {
                var createdMusic = MusicMapper.Mapper.Map <MusicResponse>(newMusic);

                return(createdMusic);
            }
            else
            {
                throw new ApplicationException("Entity Is Not Valid");
            }
        }
Beispiel #2
0
 public async Task <int> AddAsync(IMusic entity)
 {
     return(await Repository.AddAsync(entity));
 }