public async Task InsertPackagesAsync(string trackingCode, InsertPackageCommand package, long lastCheckpointId) { await _session.OpenAsync(); await _session.Connection.QueryAsync <long>( sql : $@" INSERT INTO Package( [LastCheckpointId] ,[ReceiveDate] ,[IsStoppedInCustoms] ,[HasValueToPay] ,[TrackingCode] ,[PackageWeight] ,[Size] ,[IsFragile] ,[ActualStatus] ,[Price] ,[AreaToDeliver]) VALUES( @LastCheckpointId, @ReceivedDate, @IsStoppedInCustoms, @HasValueToPay, @TrackingCode, @PackageWeight, @Size, @IsFragile, @ActualStatus, @Price, @AreaToDeliver ) ", param : new { package.ActualStatus, package.HasValueToPay, package.IsFragile, package.IsStoppedInCustoms, package.PackageWeight, package.Price, package.Size, package.AreaToDeliver, package.ReceivedDate, TrackingCode = trackingCode, LastCheckpointId = lastCheckpointId }, transaction : _session.Transaction ); }
private InsertPackageCommand getInsertPackage() { var command = new InsertPackageCommand { ActualStatus = 1, City = "City1", Country = "Portugal", HasValueToPay = false, IsFragile = true, IsStoppedInCustoms = false, PackageWeight = 100, PlaceType = 2, Price = 200, Size = 1, TypeOfControl = 0, AreaToDeliver = "AreaToDeliver1" }; command.SetReceivedDate(new DateTime(2021, 03, 25)); return(command); }
public async Task InsertPackagesAsync_Must_Insert_Package() { var dao = new PackageRepository(session); var command = new InsertPackageCommand { ActualStatus = 1, City = "CityPackageRepositoryTest", Country = "CountryPackageRepositoryTest", HasValueToPay = false, IsFragile = true, IsStoppedInCustoms = false, PackageWeight = 100, PlaceType = 2, Price = 200, Size = 1, TypeOfControl = 0, AreaToDeliver = "AreaToDeliver1" }; command.SetReceivedDate(DateTime.Now); await dao.InsertPackagesAsync("PackageRepositoryTest-PackageRepositoryTest", command, 1); }