public override int GetHashCode() { unchecked { int hash = 23; hash = hash * 17 + GenreId.GetHashCode(); hash = hash * 17 + Name.GetHashCode(); return(hash); } }
// DELETE public static Task RemoveGenre(GenreId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new GenreRepository(context); var genreService = new GenreService(repository); var command = new Commands.Delete { Id = id, }; return(genreService.Handle(command)); }
public static Task CreateInvalidGenre() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new GenreRepository(context); var genreService = new GenreService(repository); var genreId = new GenreId(SequentialGuid.NewSequentialGuid()); var command = new Commands.Create { Id = genreId }; return(genreService.Handle(command)); }
public Genre(GenreId id) { this.Id = (int)id; }
public override string ToString() { return(Genre.GenreName ?? GenreId.ToString()); }
public ValueTask <Genre> GetGenreAsync(GenreId genreId) => Context.Genres.FindAsync(genreId);