private async Task CreateDatabase() { var context = new BookOrganizer2DbContext(_connectionString); await context.Database.EnsureCreatedAsync(); Application.Current.MainWindow?.Close(); }
public DatabaseFixture() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); Context = new BookOrganizer2DbContext(connectionString); Context.Database.EnsureCreated(); }
public static async Task <Author> CreateValidAuthorWithNationality() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new AuthorRepository(context); var authorService = new AuthorService(repository); var nationality = await NationalityHelpers.CreateValidNationality(); var command = new Commands.Create { Id = new AuthorId(SequentialGuid.NewSequentialGuid()), FirstName = "Patrick", LastName = "Rothfuss", DateOfBirth = new DateTime(1973, 6, 6), MugshotPath = @"\\filepath\file.jpg", Biography = "There is no book number three.", NotesOld = "...", Nationality = nationality, Notes = new List <Note>() }; await authorService.Handle(command); return(await repository.GetAsync(command.Id)); }
public static Task CreateInvalidFormat() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new FormatRepository(context); var formatService = new FormatService(repository); var formatId = new FormatId(SequentialGuid.NewSequentialGuid()); var command = new Commands.Create { Id = formatId }; return formatService.Handle(command); }
public static Task CreateInvalidAuthor() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new AuthorRepository(context); var authorService = new AuthorService(repository); var authorId = new AuthorId(SequentialGuid.NewSequentialGuid()); var command = new Commands.Create { Id = authorId }; return(authorService.Handle(command)); }
// DELETE public static Task RemoveNationality(NationalityId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new NationalityRepository(context); var nationalityService = new NationalityService(repository); var command = new Commands.Delete { Id = id, }; return(nationalityService.Handle(command)); }
// DELETE public static Task RemoveFormat(FormatId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new FormatRepository(context); var formatService = new FormatService(repository); var command = new Commands.Delete { Id = id, }; return formatService.Handle(command); }
// DELETE public static Task RemoveLanguage(LanguageId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new LanguageRepository(context); var languageService = new LanguageService(repository); var command = new Commands.Delete { Id = id, }; return(languageService.Handle(command)); }
// DELETE public static Task RemoveAuthor(AuthorId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new AuthorRepository(context); var authorService = new AuthorService(repository); var command = new Commands.DeleteAuthor { Id = id, }; return(authorService.Handle(command)); }
public static Task UpdateAuthorLastName(AuthorId id, string lastName) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new AuthorRepository(context); var authorService = new AuthorService(repository); var command = new Commands.SetAuthorsLastName { Id = id, LastName = lastName }; return(authorService.Handle(command)); }
internal static Task UpdateLanguage(Language sut) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new LanguageRepository(context); var languageService = new LanguageService(repository); var command = new Commands.Update { Id = sut.Id, Name = sut.Name }; return(languageService.Handle(command)); }
public static Task UpdateCoverPath(BookId id, string path) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetBookCoverPath { Id = id, BookCoverPath = @"\\filepath\newFile.jpg" }; return(bookService.Handle(command)); }
public static Task UpdateSeriesReadOrder(SeriesId seriesId, ICollection <ReadOrder> newReadOrder) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new SeriesRepository(context); var seriesService = new SeriesService(repository); var command = new Commands.SetReadOrder { Id = seriesId, Books = newReadOrder }; return(seriesService.Handle(command)); }
public static Task UpdateAuthorBiography(AuthorId id, string bio) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new AuthorRepository(context); var authorService = new AuthorService(repository); var command = new Commands.SetBiography { Id = id, Biography = bio }; return(authorService.Handle(command)); }
public static Task UpdateFormats(BookId bookId, List <Format> formats) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetFormats { Id = bookId, Formats = formats }; return(bookService.Handle(command)); }
public static Task UpdateAuthors(BookId bookId, List <Author> authors) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetAuthors { Id = bookId, Authors = authors }; return(bookService.Handle(command)); }
public static Task UpdatePublisher(BookId bookId, Publisher publisher) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetPublisher { Id = bookId, Publisher = publisher }; return(bookService.Handle(command)); }
public static Task UpdateLanguage(BookId bookId, Language language) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetLanguage { Id = bookId, Language = language }; return(bookService.Handle(command)); }
public static Task UpdateReadStatus(BookId id, bool status) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetIsRead { Id = id, IsRead = false }; return(bookService.Handle(command)); }
public static Task UpdateNotes(BookId id, string notes) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetNotes { Id = id, Notes = notes }; return(bookService.Handle(command)); }
public static Task UpdateDescription(BookId id, string description) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetDescription { Id = id, Description = description }; return(bookService.Handle(command)); }
public static Task UpdateAuthorDateOfBirth(AuthorId id, DateTime dob) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new AuthorRepository(context); var authorService = new AuthorService(repository); var command = new Commands.SetAuthorDateOfBirth { Id = id, DataOfBirth = dob }; return(authorService.Handle(command)); }
public static Task UpdateAuthorMugshotPath(AuthorId id, string path) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new AuthorRepository(context); var authorService = new AuthorService(repository); var command = new Commands.SetMugshotPath { Id = id, MugshotPath = path }; return(authorService.Handle(command)); }
public static Task UpdateReleaseYear(BookId id, int year) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetReleaseYear { Id = id, ReleaseYear = year }; return(bookService.Handle(command)); }
public static Task UpdateAuthorNotes(AuthorId id, string notes) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new AuthorRepository(context); var authorService = new AuthorService(repository); var command = new Commands.SetNotesOld { Id = id, NotesOld = notes }; return(authorService.Handle(command)); }
internal static Task UpdateFormat(Format sut) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new FormatRepository(context); var formatService = new FormatService(repository); var command = new Commands.Update { Id = sut.Id, Name = sut.Name }; return formatService.Handle(command); }
public static Task UpdateAuthorNationality(AuthorId authorId, NationalityId nationalityId) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new AuthorRepository(context); var authorService = new AuthorService(repository); var command = new Commands.SetNationality { Id = authorId, NationalityId = nationalityId }; return(authorService.Handle(command)); }
public static Task UpdatePublisherLogoPath(PublisherId id, string path) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new PublisherRepository(context); var publisherService = new PublisherService(repository); var command = new Commands.SetLogoPath { Id = id, LogoPath = path }; return(publisherService.Handle(command)); }
public static Task UpdateReadDates(BookId bookId, List <BookReadDate> readDates) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetBookReadDates { Id = bookId, BookReadDates = readDates }; return(bookService.Handle(command)); }
public static Task UpdateWordCount(BookId id, int wCount) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new BookRepository(context); var bookService = new BookService(repository); var command = new Commands.SetWordCount { Id = id, WordCount = wCount }; return(bookService.Handle(command)); }