Example #1
0
        public async Task HandleAsync(DeleteLyricInput input, IDeleteLyricOutputHandler <T> output)
        {
            var dbLyric = await _lyricRepository.GetAsync(input.Id);

            if (dbLyric == null)
            {
                output.BadRequest("The given lyric does not exist");
                return;
            }

            try
            {
                await _lyricRepository.DeleteAsync(dbLyric);

                output.Success($"Successfully deleted Lyric {dbLyric.Title}");
            }
            catch (Exception)
            {
                output.BadRequest("Deleting lyric failed.");
            }
        }