From 248204ff7c02604c2ac0b403f9f181de2034b641 Mon Sep 17 00:00:00 2001 From: malimova Date: Sun, 2 Jun 2024 16:12:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B0=D0=B0=20=D0=BF=D0=BE=D0=BD=D1=8F=D1=82?= =?UTF-8?q?=D0=BD=D0=BE,=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/MessageInfoBindingModel.cs | 5 +- .../ConfectioneryDatabase.cs | 2 +- .../Migrations/20240602085942_InitialMail.cs | 22 --------- ...=> 20240602112944_InitialMail.Designer.cs} | 2 +- .../Migrations/20240602112944_InitialMail.cs | 47 +++++++++++++++++++ .../Controllers/ClientController.cs | 5 +- .../ConfectioneryRestApi/appsettings.json | 2 +- Confectionery/ConfectioneryView/App.config | 2 +- 8 files changed, 57 insertions(+), 30 deletions(-) delete mode 100644 Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602085942_InitialMail.cs rename Confectionery/ConfectioneryDatabaseImplement/Migrations/{20240602085942_InitialMail.Designer.cs => 20240602112944_InitialMail.Designer.cs} (99%) create mode 100644 Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602112944_InitialMail.cs diff --git a/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs b/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs index 0842397..e101807 100644 --- a/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs +++ b/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs @@ -1,4 +1,5 @@ -using System; +using ConfectioneryDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,7 @@ using System.Threading.Tasks; namespace ConfectioneryContracts.BindingModels { - public class MessageInfoBindingModel + public class MessageInfoBindingModel : IMessageInfoModel { public string MessageId { get; set; } = string.Empty; public int? ClientId { get; set; } diff --git a/Confectionery/ConfectioneryDatabaseImplement/ConfectioneryDatabase.cs b/Confectionery/ConfectioneryDatabaseImplement/ConfectioneryDatabase.cs index 2007c1b..96089ac 100644 --- a/Confectionery/ConfectioneryDatabaseImplement/ConfectioneryDatabase.cs +++ b/Confectionery/ConfectioneryDatabaseImplement/ConfectioneryDatabase.cs @@ -15,7 +15,7 @@ namespace ConfectioneryDatabaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=ConfectioneryDatabaseNewMailDB;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=ConfectioneryDatabase7New;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602085942_InitialMail.cs b/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602085942_InitialMail.cs deleted file mode 100644 index 4598767..0000000 --- a/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602085942_InitialMail.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ConfectioneryDatabaseImplement.Migrations -{ - /// - public partial class InitialMail : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602085942_InitialMail.Designer.cs b/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602112944_InitialMail.Designer.cs similarity index 99% rename from Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602085942_InitialMail.Designer.cs rename to Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602112944_InitialMail.Designer.cs index 4a1f863..266278d 100644 --- a/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602085942_InitialMail.Designer.cs +++ b/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602112944_InitialMail.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace ConfectioneryDatabaseImplement.Migrations { [DbContext(typeof(ConfectioneryDatabase))] - [Migration("20240602085942_InitialMail")] + [Migration("20240602112944_InitialMail")] partial class InitialMail { /// diff --git a/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602112944_InitialMail.cs b/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602112944_InitialMail.cs new file mode 100644 index 0000000..0732b3c --- /dev/null +++ b/Confectionery/ConfectioneryDatabaseImplement/Migrations/20240602112944_InitialMail.cs @@ -0,0 +1,47 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace ConfectioneryDatabaseImplement.Migrations +{ + /// + public partial class InitialMail : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "MessageInfos", + columns: table => new + { + MessageId = table.Column(type: "nvarchar(450)", nullable: false), + ClientId = table.Column(type: "int", nullable: true), + SenderName = table.Column(type: "nvarchar(max)", nullable: false), + DateDelivery = table.Column(type: "datetime2", nullable: false), + Subject = table.Column(type: "nvarchar(max)", nullable: false), + Body = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MessageInfos", x => x.MessageId); + table.ForeignKey( + name: "FK_MessageInfos_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_MessageInfos_ClientId", + table: "MessageInfos", + column: "ClientId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "MessageInfos"); + } + } +} diff --git a/Confectionery/ConfectioneryRestApi/Controllers/ClientController.cs b/Confectionery/ConfectioneryRestApi/Controllers/ClientController.cs index a94869b..2e5d53f 100644 --- a/Confectionery/ConfectioneryRestApi/Controllers/ClientController.cs +++ b/Confectionery/ConfectioneryRestApi/Controllers/ClientController.cs @@ -3,6 +3,7 @@ using ConfectioneryContracts.BusinessLogicsContracts; using ConfectioneryContracts.SearchModels; using ConfectioneryContracts.ViewModels; using Microsoft.AspNetCore.Mvc; +using System.Net; namespace ConfectioneryRestApi.Controllers { @@ -47,8 +48,8 @@ namespace ConfectioneryRestApi.Controllers catch (Exception ex) { _logger.LogError(ex, "Ошибка регистрации"); - throw; - } + Response.StatusCode = (int)HttpStatusCode.NotAcceptable; + } } [HttpPost] public void UpdateData(ClientBindingModel model) diff --git a/Confectionery/ConfectioneryRestApi/appsettings.json b/Confectionery/ConfectioneryRestApi/appsettings.json index 29841b1..461ebb9 100644 --- a/Confectionery/ConfectioneryRestApi/appsettings.json +++ b/Confectionery/ConfectioneryRestApi/appsettings.json @@ -11,5 +11,5 @@ "PopHost": "pop.gmail.com", "PopPort": "995", "MailLogin": "labworkalimova@gmail.com", - "MailPassword": "labworkalimova1!" + "MailPassword": "mrwi jpal mwmk gwgl" } diff --git a/Confectionery/ConfectioneryView/App.config b/Confectionery/ConfectioneryView/App.config index df56eb9..f3ceef9 100644 --- a/Confectionery/ConfectioneryView/App.config +++ b/Confectionery/ConfectioneryView/App.config @@ -6,6 +6,6 @@ - +