Exemple #1
0
 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));
        }
Exemple #4
0
 public Genre(GenreId id)
 {
     this.Id = (int)id;
 }
Exemple #5
0
 public override string ToString()
 {
     return(Genre.GenreName ?? GenreId.ToString());
 }
Exemple #6
0
 public ValueTask <Genre> GetGenreAsync(GenreId genreId)
 => Context.Genres.FindAsync(genreId);