diff --git a/.gitignore b/.gitignore index 330f40b..33b1777 100644 --- a/.gitignore +++ b/.gitignore @@ -371,8 +371,6 @@ healthchecksdb # Backup folder for Package Reference Convert tool in Visual Studio 2017 MigrationBackup/ -*/Migrations/* - # Ionide (cross platform F# VS Code tools) working folder .ionide/ @@ -400,8 +398,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml -/SushiBar/SushiBarDatabaseImplement/Migrations/20240522053944_lab7.Designer.cs -/SushiBar/SushiBarDatabaseImplement/Migrations/20240522053944_lab7.cs -/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs -/SushiBar/SushiBarDatabaseImplement/Migrations/20240507181620_lab6.Designer.cs -/SushiBar/SushiBarDatabaseImplement/Migrations/20240507181620_lab6.cs +/SushiBar/SushiBarDatabaseImplement/Migrations/ diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs index 877c933..c6f87db 100644 --- a/SushiBar/SushiBar/Program.cs +++ b/SushiBar/SushiBar/Program.cs @@ -30,6 +30,7 @@ namespace SushiBar var services = new ServiceCollection(); ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); + try { var mailSender = _serviceProvider.GetService(); @@ -45,6 +46,12 @@ namespace SushiBar var timer = new System.Threading.Timer(new TimerCallback(MailCheck!), null, 0, 100000); } + catch (Exception ex) + { + var logger = _serviceProvider.GetService(); + logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé"); + } + Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs index 9e5a557..71147c3 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs @@ -59,7 +59,8 @@ namespace SushiBarBusinessLogic.BusinessLogics return false; } model.Status = OrderStatus.Принят; - if (_orderStorage.Insert(model) == null) + var res = _orderStorage.Insert(model); + if (res == null) { _logger.LogWarning("Insert operation failed"); return false; diff --git a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs index f6acf97..6059fab 100644 --- a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs +++ b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs @@ -9,7 +9,7 @@ namespace SushiBarDatabaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBar_db6;Username=postgres;Password=postgres"); + optionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBar_db7;Username=postgres;Password=postgres"); } base.OnConfiguring(optionsBuilder); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);