async Task PrintAllAsync() { IEnumerable <Genre> genreCollection = await genreService.GetAllGenreAsync(); foreach (var item in genreCollection) { Console.WriteLine(item.Id + " \t " + item.Name); } }
async Task PrintAllAsync() { try { IEnumerable <Genre> genreCollection = await genreService.GetAllGenreAsync(); if (genreCollection != null) { foreach (Genre item in genreCollection) { Console.WriteLine(item.Id + " \t " + item.Name); } } else { Console.WriteLine("No data"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }