diff --git a/AutoCat/ViewModels/HistoryViewModel.cs b/AutoCat/ViewModels/HistoryViewModel.cs
index 84c7978..48a0d55 100644
--- a/AutoCat/ViewModels/HistoryViewModel.cs
+++ b/AutoCat/ViewModels/HistoryViewModel.cs
@@ -1,3 +1,4 @@
+using System;
using System.Threading.Tasks;
using AutoCatCore.Model;
using AutoCatCore.Services.Storage;
@@ -19,6 +20,16 @@ public class HistoryViewModel: ViewModelBase
public async Task AddVehicle(Vehicle vehicle)
{
- await _storageService.AddVehicle(vehicle);
+ try
+ {
+ await _storageService.AddVehicle(vehicle);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Exception: {ex.Message}");
+ Console.WriteLine($"Inner exception: {ex.InnerException?.Message}");
+ Console.WriteLine("");
+ }
+
}
}
\ No newline at end of file
diff --git a/AutoCatCore/AutoCatCore.csproj b/AutoCatCore/AutoCatCore.csproj
index b8bf6d7..c93e9f1 100644
--- a/AutoCatCore/AutoCatCore.csproj
+++ b/AutoCatCore/AutoCatCore.csproj
@@ -9,6 +9,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/AutoCatCore/Model/AutoCatDbContext.cs b/AutoCatCore/Model/AutoCatDbContext.cs
index c4960c2..cdeca7c 100644
--- a/AutoCatCore/Model/AutoCatDbContext.cs
+++ b/AutoCatCore/Model/AutoCatDbContext.cs
@@ -12,12 +12,5 @@ namespace AutoCatCore.Model
{
optionsBuilder.UseSqlite("filename=autocat.db");
}
-
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity().HasOne(v => v.Brand);
-
- modelBuilder.Entity().HasNoKey().ToView("VehicleBrandView");
- }
}
}
diff --git a/AutoCatCore/Model/Osago.cs b/AutoCatCore/Model/Osago.cs
index cd8f541..44ed7b5 100644
--- a/AutoCatCore/Model/Osago.cs
+++ b/AutoCatCore/Model/Osago.cs
@@ -4,7 +4,7 @@ namespace AutoCatCore.Model
{
public class Osago
{
- [Key]
+ public int Id { get; set; }
public string? Number { get; set; }
public double? Date { get; set; }
public string? Vin { get; set; }
diff --git a/AutoCatCore/Model/User.cs b/AutoCatCore/Model/User.cs
index c78e515..2f1dc74 100644
--- a/AutoCatCore/Model/User.cs
+++ b/AutoCatCore/Model/User.cs
@@ -7,17 +7,17 @@ namespace AutoCatCore.Model
{
[Key]
[MaxLength(50)]
- public string Email { get; set; } = email;
+ public string Email { get; init; } = email;
[MaxLength(300)]
- public string? Token { get; set; } = token;
+ public string? Token { get; init; } = token;
[JsonIgnore]
[MaxLength(300)]
- public string? FirebaseIdToken { get; set; }
+ public string? FirebaseIdToken { get; init; }
[JsonIgnore]
[MaxLength(300)]
- public string? FirebaseRefreshToken { get; set; }
+ public string? FirebaseRefreshToken { get; init; }
}
}
diff --git a/AutoCatCore/Model/Vehicle.cs b/AutoCatCore/Model/Vehicle.cs
index fe07500..44e195d 100644
--- a/AutoCatCore/Model/Vehicle.cs
+++ b/AutoCatCore/Model/Vehicle.cs
@@ -24,8 +24,8 @@ namespace AutoCatCore.Model
public VehicleEngine Engine { get; set; }
public List Photos { get; set; }
public List Events { get; set; }
- public List OsagoContracts { get; set; } = new List();
- public List OwnershipPeriods { get; set; } = new List();
+ 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 e1f9411..ca240a2 100644
--- a/AutoCatCore/Model/VehicleAd.cs
+++ b/AutoCatCore/Model/VehicleAd.cs
@@ -4,7 +4,6 @@ namespace AutoCatCore.Model
{
public class VehicleAd
{
- [Key]
public int Id { get; set; }
public string Url { get; set; }
public string Price { get; set; }
diff --git a/AutoCatCore/Model/VehicleBrand.cs b/AutoCatCore/Model/VehicleBrand.cs
index 585078b..273fe35 100644
--- a/AutoCatCore/Model/VehicleBrand.cs
+++ b/AutoCatCore/Model/VehicleBrand.cs
@@ -2,6 +2,7 @@
{
public class VehicleBrand
{
+ public int Id { get; set; }
public VehicleName Name { get; set; }
public string Logo { get; set; }
}
diff --git a/AutoCatCore/Model/VehicleEngine.cs b/AutoCatCore/Model/VehicleEngine.cs
index 643e8a7..b6db6ed 100644
--- a/AutoCatCore/Model/VehicleEngine.cs
+++ b/AutoCatCore/Model/VehicleEngine.cs
@@ -2,6 +2,7 @@
{
public class VehicleEngine
{
+ public int Id { get; set; }
public string Number { get; set; }
public int? Volume { get; set; }
public double? PowerKw { get; set; }
diff --git a/AutoCatCore/Model/VehicleEvent.cs b/AutoCatCore/Model/VehicleEvent.cs
index 9879d02..b20e3b2 100644
--- a/AutoCatCore/Model/VehicleEvent.cs
+++ b/AutoCatCore/Model/VehicleEvent.cs
@@ -4,7 +4,6 @@ namespace AutoCatCore.Model
{
public class VehicleEvent
{
- [Key]
public string Id { get; set; }
public double Date { get; set; }
public double Latitude { get; set; }
diff --git a/AutoCatCore/Model/VehicleModel.cs b/AutoCatCore/Model/VehicleModel.cs
index cf98363..06cad2d 100644
--- a/AutoCatCore/Model/VehicleModel.cs
+++ b/AutoCatCore/Model/VehicleModel.cs
@@ -2,6 +2,7 @@
{
public class VehicleModel
{
+ public int Id { get; set; }
public VehicleName Name { get; set; }
}
}
diff --git a/AutoCatCore/Model/VehicleName.cs b/AutoCatCore/Model/VehicleName.cs
index 912a98a..ee8b631 100644
--- a/AutoCatCore/Model/VehicleName.cs
+++ b/AutoCatCore/Model/VehicleName.cs
@@ -1,7 +1,10 @@
-namespace AutoCatCore.Model
+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; }
}
diff --git a/AutoCatCore/Model/VehicleOwnershipPeriod.cs b/AutoCatCore/Model/VehicleOwnershipPeriod.cs
index ba98d6a..bb14f9a 100644
--- a/AutoCatCore/Model/VehicleOwnershipPeriod.cs
+++ b/AutoCatCore/Model/VehicleOwnershipPeriod.cs
@@ -2,6 +2,7 @@
{
public class VehicleOwnershipPeriod
{
+ public int Id { get; set; }
public string LastOperation { get; set; }
public string OwnerType { get; set; }
public Int64 From { get; set; }
diff --git a/AutoCatCore/Model/VehiclePhoto.cs b/AutoCatCore/Model/VehiclePhoto.cs
index 058848f..087c98c 100644
--- a/AutoCatCore/Model/VehiclePhoto.cs
+++ b/AutoCatCore/Model/VehiclePhoto.cs
@@ -2,6 +2,7 @@
{
public class VehiclePhoto
{
+ public int Id { get; set; }
public string Brand { get; set; }
public string Model { get; set; }
public double Date { get; set; }