diff --git a/AutoCat/Mocks/HistoryListViewModelMock.cs b/AutoCat/Mocks/HistoryListViewModelMock.cs index 26e1715..fb4bfe1 100644 --- a/AutoCat/Mocks/HistoryListViewModelMock.cs +++ b/AutoCat/Mocks/HistoryListViewModelMock.cs @@ -10,20 +10,9 @@ public class HistoryListViewModelMock: ViewModelBase public HistoryListViewModelMock() { - var vehicle1 = new Vehicle - { - Number = "А007АА761" - }; - - var vehicle2 = new Vehicle - { - Number = "А008АА761" - }; - - var vehicle3 = new Vehicle - { - Number = "А009АА761" - }; + var vehicle1 = new Vehicle("А007АА761"); + var vehicle2 = new Vehicle("А007АА761"); + var vehicle3 = new Vehicle("А007АА761"); Vehicles = new ObservableCollection { vehicle1, vehicle2, vehicle3 }; } diff --git a/AutoCatCore/Migrations/20240508141817_InitialCreate.Designer.cs b/AutoCatCore/Migrations/20240508141817_InitialCreate.Designer.cs new file mode 100644 index 0000000..c743e90 --- /dev/null +++ b/AutoCatCore/Migrations/20240508141817_InitialCreate.Designer.cs @@ -0,0 +1,510 @@ +// +using System; +using AutoCatCore.Model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace AutoCatCore.Migrations +{ + [DbContext(typeof(AutoCatDbContext))] + [Migration("20240508141817_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.4"); + + modelBuilder.Entity("AutoCatCore.Model.Osago", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Date") + .HasColumnType("REAL"); + + b.Property("Insurant") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Number") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Owner") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("PlateNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Restrictions") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Status") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("UsageRegion") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.Property("Vin") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("Osago"); + }); + + modelBuilder.Entity("AutoCatCore.Model.User", b => + { + b.Property("Email") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("FirebaseIdToken") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("FirebaseRefreshToken") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("Token") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.HasKey("Email"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("AutoCatCore.Model.Vehicle", b => + { + b.Property("Number") + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("AddedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("AddedDate") + .HasColumnType("REAL"); + + b.Property("BrandId") + .HasColumnType("INTEGER"); + + b.Property("Category") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Color") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentNumber") + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("EngineId") + .HasColumnType("INTEGER"); + + b.Property("IsJapanese") + .HasColumnType("INTEGER"); + + b.Property("IsRightWheel") + .HasColumnType("INTEGER"); + + b.Property("ModelId") + .HasColumnType("INTEGER"); + + b.Property("Pts") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Sts") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdatedDate") + .HasColumnType("REAL"); + + b.Property("Vin1") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Vin2") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Number"); + + b.HasIndex("BrandId"); + + b.HasIndex("EngineId"); + + b.HasIndex("ModelId"); + + b.ToTable("Vehicles"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleAd", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AdDescription") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("City") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Date") + .HasMaxLength(50) + .HasColumnType("REAL"); + + b.Property("Mileage") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Photos") + .HasColumnType("TEXT"); + + b.Property("Price") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Region") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Url") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("VehicleAd"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleBrand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Logo") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("NameId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("NameId"); + + b.ToTable("VehicleBrand"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleEngine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("FuelType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Number") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("PowerHp") + .HasColumnType("REAL"); + + b.Property("PowerKw") + .HasColumnType("REAL"); + + b.Property("Volume") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("VehicleEngine"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("REAL"); + + b.Property("Latitude") + .HasColumnType("REAL"); + + b.Property("Longitude") + .HasColumnType("REAL"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("VehicleEvent"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("NameId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("NameId"); + + b.ToTable("VehicleModel"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleName", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Normalized") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Original") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("VehicleName"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleOwnershipPeriod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Building") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Code") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("From") + .HasColumnType("INTEGER"); + + b.Property("Inn") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastOperation") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Locality") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OwnerType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Region") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("RegistrationRegion") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("Street") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("To") + .HasColumnType("INTEGER"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("VehicleOwnershipPeriod"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehiclePhoto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Brand") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("REAL"); + + b.Property("Model") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Url") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("VehiclePhoto"); + }); + + modelBuilder.Entity("AutoCatCore.Model.Osago", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("OsagoContracts") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.Vehicle", b => + { + b.HasOne("AutoCatCore.Model.VehicleBrand", "Brand") + .WithMany() + .HasForeignKey("BrandId"); + + b.HasOne("AutoCatCore.Model.VehicleEngine", "Engine") + .WithMany() + .HasForeignKey("EngineId"); + + b.HasOne("AutoCatCore.Model.VehicleModel", "Model") + .WithMany() + .HasForeignKey("ModelId"); + + b.Navigation("Brand"); + + b.Navigation("Engine"); + + b.Navigation("Model"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleAd", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("Ads") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleBrand", b => + { + b.HasOne("AutoCatCore.Model.VehicleName", "Name") + .WithMany() + .HasForeignKey("NameId"); + + b.Navigation("Name"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleEvent", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("Events") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleModel", b => + { + b.HasOne("AutoCatCore.Model.VehicleName", "Name") + .WithMany() + .HasForeignKey("NameId"); + + b.Navigation("Name"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleOwnershipPeriod", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("OwnershipPeriods") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehiclePhoto", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("Photos") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.Vehicle", b => + { + b.Navigation("Ads"); + + b.Navigation("Events"); + + b.Navigation("OsagoContracts"); + + b.Navigation("OwnershipPeriods"); + + b.Navigation("Photos"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AutoCatCore/Migrations/20240508141817_InitialCreate.cs b/AutoCatCore/Migrations/20240508141817_InitialCreate.cs new file mode 100644 index 0000000..0bb83de --- /dev/null +++ b/AutoCatCore/Migrations/20240508141817_InitialCreate.cs @@ -0,0 +1,351 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AutoCatCore.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Email = table.Column(type: "TEXT", maxLength: 50, nullable: false), + Token = table.Column(type: "TEXT", maxLength: 300, nullable: true), + FirebaseIdToken = table.Column(type: "TEXT", maxLength: 300, nullable: true), + FirebaseRefreshToken = table.Column(type: "TEXT", maxLength: 300, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Email); + }); + + migrationBuilder.CreateTable( + name: "VehicleEngine", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Number = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Volume = table.Column(type: "INTEGER", nullable: true), + PowerKw = table.Column(type: "REAL", nullable: true), + PowerHp = table.Column(type: "REAL", nullable: true), + FuelType = table.Column(type: "TEXT", maxLength: 100, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleEngine", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "VehicleName", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Original = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Normalized = table.Column(type: "TEXT", maxLength: 100, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleName", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "VehicleBrand", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + NameId = table.Column(type: "INTEGER", nullable: true), + Logo = table.Column(type: "TEXT", maxLength: 200, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleBrand", x => x.Id); + table.ForeignKey( + name: "FK_VehicleBrand_VehicleName_NameId", + column: x => x.NameId, + principalTable: "VehicleName", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "VehicleModel", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + NameId = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleModel", x => x.Id); + table.ForeignKey( + name: "FK_VehicleModel_VehicleName_NameId", + column: x => x.NameId, + principalTable: "VehicleName", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "Vehicles", + columns: table => new + { + Number = table.Column(type: "TEXT", maxLength: 10, nullable: false), + CurrentNumber = table.Column(type: "TEXT", maxLength: 10, nullable: true), + Vin1 = table.Column(type: "TEXT", maxLength: 50, nullable: true), + Vin2 = table.Column(type: "TEXT", maxLength: 50, nullable: true), + Sts = table.Column(type: "TEXT", maxLength: 50, nullable: true), + Pts = table.Column(type: "TEXT", maxLength: 50, nullable: true), + BrandId = table.Column(type: "INTEGER", nullable: true), + ModelId = table.Column(type: "INTEGER", nullable: true), + Color = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Year = table.Column(type: "INTEGER", nullable: true), + Category = table.Column(type: "TEXT", maxLength: 100, nullable: true), + IsRightWheel = table.Column(type: "INTEGER", nullable: true), + IsJapanese = table.Column(type: "INTEGER", nullable: true), + AddedDate = table.Column(type: "REAL", nullable: true), + UpdatedDate = table.Column(type: "REAL", nullable: true), + AddedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true), + EngineId = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Vehicles", x => x.Number); + table.ForeignKey( + name: "FK_Vehicles_VehicleBrand_BrandId", + column: x => x.BrandId, + principalTable: "VehicleBrand", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Vehicles_VehicleEngine_EngineId", + column: x => x.EngineId, + principalTable: "VehicleEngine", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Vehicles_VehicleModel_ModelId", + column: x => x.ModelId, + principalTable: "VehicleModel", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "Osago", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Number = table.Column(type: "TEXT", maxLength: 50, nullable: true), + Date = table.Column(type: "REAL", nullable: true), + Vin = table.Column(type: "TEXT", maxLength: 50, nullable: true), + PlateNumber = table.Column(type: "TEXT", maxLength: 50, nullable: true), + Name = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Status = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Restrictions = table.Column(type: "TEXT", maxLength: 500, nullable: true), + Insurant = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Owner = table.Column(type: "TEXT", maxLength: 100, nullable: true), + UsageRegion = table.Column(type: "TEXT", maxLength: 100, nullable: true), + VehicleNumber = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Osago", x => x.Id); + table.ForeignKey( + name: "FK_Osago_Vehicles_VehicleNumber", + column: x => x.VehicleNumber, + principalTable: "Vehicles", + principalColumn: "Number"); + }); + + migrationBuilder.CreateTable( + name: "VehicleAd", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Url = table.Column(type: "TEXT", maxLength: 200, nullable: true), + Price = table.Column(type: "TEXT", maxLength: 50, nullable: true), + Date = table.Column(type: "REAL", maxLength: 50, nullable: true), + Mileage = table.Column(type: "TEXT", maxLength: 50, nullable: true), + Region = table.Column(type: "TEXT", maxLength: 100, nullable: true), + City = table.Column(type: "TEXT", maxLength: 100, nullable: true), + AdDescription = table.Column(type: "TEXT", maxLength: 500, nullable: true), + Photos = table.Column(type: "TEXT", nullable: true), + VehicleNumber = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleAd", x => x.Id); + table.ForeignKey( + name: "FK_VehicleAd_Vehicles_VehicleNumber", + column: x => x.VehicleNumber, + principalTable: "Vehicles", + principalColumn: "Number"); + }); + + migrationBuilder.CreateTable( + name: "VehicleEvent", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Date = table.Column(type: "REAL", nullable: true), + Latitude = table.Column(type: "REAL", nullable: true), + Longitude = table.Column(type: "REAL", nullable: true), + Address = table.Column(type: "TEXT", maxLength: 100, nullable: true), + VehicleNumber = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleEvent", x => x.Id); + table.ForeignKey( + name: "FK_VehicleEvent_Vehicles_VehicleNumber", + column: x => x.VehicleNumber, + principalTable: "Vehicles", + principalColumn: "Number"); + }); + + migrationBuilder.CreateTable( + name: "VehicleOwnershipPeriod", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + LastOperation = table.Column(type: "TEXT", maxLength: 500, nullable: true), + OwnerType = table.Column(type: "TEXT", maxLength: 100, nullable: true), + From = table.Column(type: "INTEGER", nullable: true), + To = table.Column(type: "INTEGER", nullable: true), + Region = table.Column(type: "TEXT", maxLength: 300, nullable: true), + RegistrationRegion = table.Column(type: "TEXT", maxLength: 300, nullable: true), + Locality = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Code = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Street = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Building = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Inn = table.Column(type: "TEXT", maxLength: 100, nullable: true), + VehicleNumber = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleOwnershipPeriod", x => x.Id); + table.ForeignKey( + name: "FK_VehicleOwnershipPeriod_Vehicles_VehicleNumber", + column: x => x.VehicleNumber, + principalTable: "Vehicles", + principalColumn: "Number"); + }); + + migrationBuilder.CreateTable( + name: "VehiclePhoto", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Brand = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Model = table.Column(type: "TEXT", maxLength: 100, nullable: true), + Date = table.Column(type: "REAL", nullable: true), + Url = table.Column(type: "TEXT", maxLength: 500, nullable: true), + VehicleNumber = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehiclePhoto", x => x.Id); + table.ForeignKey( + name: "FK_VehiclePhoto_Vehicles_VehicleNumber", + column: x => x.VehicleNumber, + principalTable: "Vehicles", + principalColumn: "Number"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Osago_VehicleNumber", + table: "Osago", + column: "VehicleNumber"); + + migrationBuilder.CreateIndex( + name: "IX_VehicleAd_VehicleNumber", + table: "VehicleAd", + column: "VehicleNumber"); + + migrationBuilder.CreateIndex( + name: "IX_VehicleBrand_NameId", + table: "VehicleBrand", + column: "NameId"); + + migrationBuilder.CreateIndex( + name: "IX_VehicleEvent_VehicleNumber", + table: "VehicleEvent", + column: "VehicleNumber"); + + migrationBuilder.CreateIndex( + name: "IX_VehicleModel_NameId", + table: "VehicleModel", + column: "NameId"); + + migrationBuilder.CreateIndex( + name: "IX_VehicleOwnershipPeriod_VehicleNumber", + table: "VehicleOwnershipPeriod", + column: "VehicleNumber"); + + migrationBuilder.CreateIndex( + name: "IX_VehiclePhoto_VehicleNumber", + table: "VehiclePhoto", + column: "VehicleNumber"); + + migrationBuilder.CreateIndex( + name: "IX_Vehicles_BrandId", + table: "Vehicles", + column: "BrandId"); + + migrationBuilder.CreateIndex( + name: "IX_Vehicles_EngineId", + table: "Vehicles", + column: "EngineId"); + + migrationBuilder.CreateIndex( + name: "IX_Vehicles_ModelId", + table: "Vehicles", + column: "ModelId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Osago"); + + migrationBuilder.DropTable( + name: "Users"); + + migrationBuilder.DropTable( + name: "VehicleAd"); + + migrationBuilder.DropTable( + name: "VehicleEvent"); + + migrationBuilder.DropTable( + name: "VehicleOwnershipPeriod"); + + migrationBuilder.DropTable( + name: "VehiclePhoto"); + + migrationBuilder.DropTable( + name: "Vehicles"); + + migrationBuilder.DropTable( + name: "VehicleBrand"); + + migrationBuilder.DropTable( + name: "VehicleEngine"); + + migrationBuilder.DropTable( + name: "VehicleModel"); + + migrationBuilder.DropTable( + name: "VehicleName"); + } + } +} diff --git a/AutoCatCore/Migrations/AutoCatDbContextModelSnapshot.cs b/AutoCatCore/Migrations/AutoCatDbContextModelSnapshot.cs new file mode 100644 index 0000000..57004dc --- /dev/null +++ b/AutoCatCore/Migrations/AutoCatDbContextModelSnapshot.cs @@ -0,0 +1,507 @@ +// +using System; +using AutoCatCore.Model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace AutoCatCore.Migrations +{ + [DbContext(typeof(AutoCatDbContext))] + partial class AutoCatDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.4"); + + modelBuilder.Entity("AutoCatCore.Model.Osago", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Date") + .HasColumnType("REAL"); + + b.Property("Insurant") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Number") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Owner") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("PlateNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Restrictions") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Status") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("UsageRegion") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.Property("Vin") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("Osago"); + }); + + modelBuilder.Entity("AutoCatCore.Model.User", b => + { + b.Property("Email") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("FirebaseIdToken") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("FirebaseRefreshToken") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("Token") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.HasKey("Email"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("AutoCatCore.Model.Vehicle", b => + { + b.Property("Number") + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("AddedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("AddedDate") + .HasColumnType("REAL"); + + b.Property("BrandId") + .HasColumnType("INTEGER"); + + b.Property("Category") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Color") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentNumber") + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("EngineId") + .HasColumnType("INTEGER"); + + b.Property("IsJapanese") + .HasColumnType("INTEGER"); + + b.Property("IsRightWheel") + .HasColumnType("INTEGER"); + + b.Property("ModelId") + .HasColumnType("INTEGER"); + + b.Property("Pts") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Sts") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdatedDate") + .HasColumnType("REAL"); + + b.Property("Vin1") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Vin2") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Number"); + + b.HasIndex("BrandId"); + + b.HasIndex("EngineId"); + + b.HasIndex("ModelId"); + + b.ToTable("Vehicles"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleAd", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AdDescription") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("City") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Date") + .HasMaxLength(50) + .HasColumnType("REAL"); + + b.Property("Mileage") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Photos") + .HasColumnType("TEXT"); + + b.Property("Price") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Region") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Url") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("VehicleAd"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleBrand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Logo") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("NameId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("NameId"); + + b.ToTable("VehicleBrand"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleEngine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("FuelType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Number") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("PowerHp") + .HasColumnType("REAL"); + + b.Property("PowerKw") + .HasColumnType("REAL"); + + b.Property("Volume") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("VehicleEngine"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("REAL"); + + b.Property("Latitude") + .HasColumnType("REAL"); + + b.Property("Longitude") + .HasColumnType("REAL"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("VehicleEvent"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("NameId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("NameId"); + + b.ToTable("VehicleModel"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleName", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Normalized") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Original") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("VehicleName"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleOwnershipPeriod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Building") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Code") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("From") + .HasColumnType("INTEGER"); + + b.Property("Inn") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastOperation") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Locality") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OwnerType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Region") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("RegistrationRegion") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("Street") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("To") + .HasColumnType("INTEGER"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("VehicleOwnershipPeriod"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehiclePhoto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Brand") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("REAL"); + + b.Property("Model") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Url") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("VehicleNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VehicleNumber"); + + b.ToTable("VehiclePhoto"); + }); + + modelBuilder.Entity("AutoCatCore.Model.Osago", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("OsagoContracts") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.Vehicle", b => + { + b.HasOne("AutoCatCore.Model.VehicleBrand", "Brand") + .WithMany() + .HasForeignKey("BrandId"); + + b.HasOne("AutoCatCore.Model.VehicleEngine", "Engine") + .WithMany() + .HasForeignKey("EngineId"); + + b.HasOne("AutoCatCore.Model.VehicleModel", "Model") + .WithMany() + .HasForeignKey("ModelId"); + + b.Navigation("Brand"); + + b.Navigation("Engine"); + + b.Navigation("Model"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleAd", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("Ads") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleBrand", b => + { + b.HasOne("AutoCatCore.Model.VehicleName", "Name") + .WithMany() + .HasForeignKey("NameId"); + + b.Navigation("Name"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleEvent", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("Events") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleModel", b => + { + b.HasOne("AutoCatCore.Model.VehicleName", "Name") + .WithMany() + .HasForeignKey("NameId"); + + b.Navigation("Name"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehicleOwnershipPeriod", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("OwnershipPeriods") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.VehiclePhoto", b => + { + b.HasOne("AutoCatCore.Model.Vehicle", null) + .WithMany("Photos") + .HasForeignKey("VehicleNumber"); + }); + + modelBuilder.Entity("AutoCatCore.Model.Vehicle", b => + { + b.Navigation("Ads"); + + b.Navigation("Events"); + + b.Navigation("OsagoContracts"); + + b.Navigation("OwnershipPeriods"); + + b.Navigation("Photos"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AutoCatCore/Model/Osago.cs b/AutoCatCore/Model/Osago.cs index 44ed7b5..0786ab0 100644 --- a/AutoCatCore/Model/Osago.cs +++ b/AutoCatCore/Model/Osago.cs @@ -5,15 +5,24 @@ namespace AutoCatCore.Model public class Osago { public int Id { get; set; } + [MaxLength(50)] public string? Number { get; set; } public double? Date { get; set; } + [MaxLength(50)] public string? Vin { get; set; } + [MaxLength(50)] public string? PlateNumber { get; set; } + [MaxLength(100)] public string? Name { get; set; } + [MaxLength(100)] public string? Status { get; set; } + [MaxLength(500)] public string? Restrictions { get; set; } + [MaxLength(100)] public string? Insurant { get; set; } + [MaxLength(100)] public string? Owner { get; set; } + [MaxLength(100)] public string? UsageRegion { get; set; } } } diff --git a/AutoCatCore/Model/Vehicle.cs b/AutoCatCore/Model/Vehicle.cs index 44e195d..42f64e0 100644 --- a/AutoCatCore/Model/Vehicle.cs +++ b/AutoCatCore/Model/Vehicle.cs @@ -2,30 +2,54 @@ namespace AutoCatCore.Model { - public class Vehicle + public class Vehicle(string number) { - [Key] - public string Number { get; set; } - public string CurrentNumber { get; set; } - public string Vin1 { get; set; } - public string Vin2 { get; set; } - public string Sts { get; set; } - public string Pts { get; set; } - public VehicleBrand Brand { get; set; } - public VehicleModel Model { get; set; } - public string Color { get; set; } - public int Year { get; set; } - public string Category { get; set; } + [Key] [MaxLength(10)] + public string Number { get; set; } = number; + + [MaxLength(10)] + public string? CurrentNumber { get; set; } + + [MaxLength(50)] + public string? Vin1 { get; set; } + + [MaxLength(50)] + public string? Vin2 { get; set; } + + [MaxLength(50)] + public string? Sts { get; set; } + + [MaxLength(50)] + public string? Pts { get; set; } + + public VehicleBrand? Brand { get; set; } + + public VehicleModel? Model { get; set; } + + [MaxLength(100)] + public string? Color { get; set; } + + public int? Year { get; set; } + + [MaxLength(100)] + public string? Category { get; set; } + public bool? IsRightWheel { get; set; } + public bool? IsJapanese { get; set; } - public double AddedDate { get; set; } - public double UpdatedDate { get; set; } - public string AddedBy { get; set; } - public VehicleEngine Engine { get; set; } - public List Photos { get; set; } - public List Events { get; set; } - public List OsagoContracts { get; set; } - public List OwnershipPeriods { get; set; } - public List Ads { get; set; } + + public double? AddedDate { get; set; } + + public double? UpdatedDate { get; set; } + + [MaxLength(100)] + public string? AddedBy { get; set; } + + public VehicleEngine? Engine { get; set; } + public List? Photos { get; set; } + public List? Events { get; set; } + public List? OsagoContracts { get; set; } + public List? OwnershipPeriods { get; set; } + public List? Ads { get; set; } } } diff --git a/AutoCatCore/Model/VehicleAd.cs b/AutoCatCore/Model/VehicleAd.cs index ca240a2..ea2df11 100644 --- a/AutoCatCore/Model/VehicleAd.cs +++ b/AutoCatCore/Model/VehicleAd.cs @@ -5,13 +5,20 @@ namespace AutoCatCore.Model public class VehicleAd { public int Id { get; set; } - public string Url { get; set; } - public string Price { get; set; } - public double Date { get; set; } - public string Mileage { get; set; } - public string Region { get; set; } - public string City { get; set; } - public string AdDescription { get; set; } - public List Photos { get; set; } + [MaxLength(200)] + public string? Url { get; set; } + [MaxLength(50)] + public string? Price { get; set; } + [MaxLength(50)] + public double? Date { get; set; } + [MaxLength(50)] + public string? Mileage { get; set; } + [MaxLength(100)] + public string? Region { get; set; } + [MaxLength(100)] + public string? City { get; set; } + [MaxLength(500)] + public string? AdDescription { get; set; } + public List? Photos { get; set; } } } diff --git a/AutoCatCore/Model/VehicleBrand.cs b/AutoCatCore/Model/VehicleBrand.cs index 273fe35..37602ca 100644 --- a/AutoCatCore/Model/VehicleBrand.cs +++ b/AutoCatCore/Model/VehicleBrand.cs @@ -1,9 +1,14 @@ -namespace AutoCatCore.Model +using System.ComponentModel.DataAnnotations; + +namespace AutoCatCore.Model { public class VehicleBrand { public int Id { get; set; } - public VehicleName Name { get; set; } - public string Logo { get; set; } + + public VehicleName? Name { get; set; } + + [MaxLength(200)] + public string? Logo { get; set; } } } diff --git a/AutoCatCore/Model/VehicleEngine.cs b/AutoCatCore/Model/VehicleEngine.cs index b6db6ed..53eb2b7 100644 --- a/AutoCatCore/Model/VehicleEngine.cs +++ b/AutoCatCore/Model/VehicleEngine.cs @@ -1,12 +1,21 @@ -namespace AutoCatCore.Model +using System.ComponentModel.DataAnnotations; + +namespace AutoCatCore.Model { public class VehicleEngine { public int Id { get; set; } - public string Number { get; set; } + + [MaxLength(100)] + public string? Number { get; set; } + public int? Volume { get; set; } + public double? PowerKw { get; set; } + public double? PowerHp { get; set; } - public string FuelType { get; set; } + + [MaxLength(100)] + public string? FuelType { get; set; } } } diff --git a/AutoCatCore/Model/VehicleEvent.cs b/AutoCatCore/Model/VehicleEvent.cs index b20e3b2..4ca8b21 100644 --- a/AutoCatCore/Model/VehicleEvent.cs +++ b/AutoCatCore/Model/VehicleEvent.cs @@ -5,9 +5,14 @@ namespace AutoCatCore.Model public class VehicleEvent { public string Id { get; set; } - public double Date { get; set; } - public double Latitude { get; set; } - public double Longitude { get; set; } - public string Address { get; set; } + + public double? Date { get; set; } + + public double? Latitude { get; set; } + + public double? Longitude { get; set; } + + [MaxLength(100)] + public string? Address { get; set; } } } diff --git a/AutoCatCore/Model/VehicleModel.cs b/AutoCatCore/Model/VehicleModel.cs index 06cad2d..8b2e9ec 100644 --- a/AutoCatCore/Model/VehicleModel.cs +++ b/AutoCatCore/Model/VehicleModel.cs @@ -3,6 +3,6 @@ public class VehicleModel { public int Id { get; set; } - public VehicleName Name { get; set; } + public VehicleName? Name { get; set; } } } diff --git a/AutoCatCore/Model/VehicleName.cs b/AutoCatCore/Model/VehicleName.cs index ee8b631..1f00a9d 100644 --- a/AutoCatCore/Model/VehicleName.cs +++ b/AutoCatCore/Model/VehicleName.cs @@ -1,11 +1,16 @@ -using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace AutoCatCore.Model { public class VehicleName { public int Id { get; set; } - public string Original { get; set; } - public string Normalized { get; set; } + + [MaxLength(100)] + public string? Original { get; set; } + + [MaxLength(100)] + public string? Normalized { get; set; } } } diff --git a/AutoCatCore/Model/VehicleOwnershipPeriod.cs b/AutoCatCore/Model/VehicleOwnershipPeriod.cs index bb14f9a..50acf88 100644 --- a/AutoCatCore/Model/VehicleOwnershipPeriod.cs +++ b/AutoCatCore/Model/VehicleOwnershipPeriod.cs @@ -1,18 +1,40 @@ -namespace AutoCatCore.Model +using System.ComponentModel.DataAnnotations; + +namespace AutoCatCore.Model { public class VehicleOwnershipPeriod { public int Id { get; set; } - public string LastOperation { get; set; } - public string OwnerType { get; set; } - public Int64 From { get; set; } - public Int64 To { get; set; } - public string Region { get; set; } - public string RegistrationRegion { get; set; } - public string Locality { get; set; } - public string Code { get; set; } - public string Street { get; set; } - public string Building { get; set; } - public string Inn { get; set; } + + [MaxLength(500)] + public string? LastOperation { get; set; } + + [MaxLength(100)] + public string? OwnerType { get; set; } + + public long? From { get; set; } + + public long? To { get; set; } + + [MaxLength(300)] + public string? Region { get; set; } + + [MaxLength(300)] + public string? RegistrationRegion { get; set; } + + [MaxLength(100)] + public string? Locality { get; set; } + + [MaxLength(100)] + public string? Code { get; set; } + + [MaxLength(100)] + public string? Street { get; set; } + + [MaxLength(100)] + public string? Building { get; set; } + + [MaxLength(100)] + public string? Inn { get; set; } } } diff --git a/AutoCatCore/Model/VehiclePhoto.cs b/AutoCatCore/Model/VehiclePhoto.cs index 087c98c..81a85c7 100644 --- a/AutoCatCore/Model/VehiclePhoto.cs +++ b/AutoCatCore/Model/VehiclePhoto.cs @@ -1,11 +1,20 @@ -namespace AutoCatCore.Model +using System.ComponentModel.DataAnnotations; + +namespace AutoCatCore.Model { public class VehiclePhoto { public int Id { get; set; } - public string Brand { get; set; } - public string Model { get; set; } - public double Date { get; set; } - public string Url { get; set; } + + [MaxLength(100)] + public string? Brand { get; set; } + + [MaxLength(100)] + public string? Model { get; set; } + + public double? Date { get; set; } + + [MaxLength(500)] + public string? Url { get; set; } } } diff --git a/AutoCatCore/Services/Storage/StorageService.cs b/AutoCatCore/Services/Storage/StorageService.cs index b35d4b7..ae5109d 100644 --- a/AutoCatCore/Services/Storage/StorageService.cs +++ b/AutoCatCore/Services/Storage/StorageService.cs @@ -1,5 +1,8 @@ +using System.Collections.ObjectModel; +using System.Collections.Specialized; using AutoCatCore.Model; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; namespace AutoCatCore.Services.Storage; @@ -38,4 +41,9 @@ public class StorageService: IStorageService await _dbContext.Vehicles.AddAsync(vehicle); await _dbContext.SaveChangesAsync(); } + + public T GetVehicles() where T: INotifyCollectionChanged + { + return _dbContext.Vehicles.Local; + } } \ No newline at end of file diff --git a/AutoCatCore/autocat.db b/AutoCatCore/autocat.db new file mode 100644 index 0000000..78d13d8 Binary files /dev/null and b/AutoCatCore/autocat.db differ