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 @@ - +