// 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)); }
public static Task CreateInvalidNationality() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new NationalityRepository(context); var nationalityService = new NationalityService(repository); var nationalityId = new NationalityId(SequentialGuid.NewSequentialGuid()); var command = new Commands.Create { Id = nationalityId }; return(nationalityService.Handle(command)); }
internal static Task UpdateNationality(Nationality sut) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new NationalityRepository(context); var nationalityService = new NationalityService(repository); var command = new Commands.Update { Id = sut.Id, Name = sut.Name }; return(nationalityService.Handle(command)); }
public static async Task <Nationality> CreateValidNationality() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new NationalityRepository(context); var nationalityService = new NationalityService(repository); var command = new Commands.Create { Id = new NationalityId(SequentialGuid.NewSequentialGuid()), Name = "american" }; await nationalityService.Handle(command); return(await repository.GetAsync(command.Id)); }