аа понятно, теперь работает

This commit is contained in:
malimova 2024-06-02 16:12:47 +04:00
parent 059eede984
commit 248204ff7c
8 changed files with 57 additions and 30 deletions

View File

@ -1,4 +1,5 @@
using System; using ConfectioneryDataModels.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace ConfectioneryContracts.BindingModels namespace ConfectioneryContracts.BindingModels
{ {
public class MessageInfoBindingModel public class MessageInfoBindingModel : IMessageInfoModel
{ {
public string MessageId { get; set; } = string.Empty; public string MessageId { get; set; } = string.Empty;
public int? ClientId { get; set; } public int? ClientId { get; set; }

View File

@ -15,7 +15,7 @@ namespace ConfectioneryDatabaseImplement
{ {
if (optionsBuilder.IsConfigured == false) 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); base.OnConfiguring(optionsBuilder);
} }

View File

@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ConfectioneryDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class InitialMail : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ConfectioneryDatabaseImplement.Migrations namespace ConfectioneryDatabaseImplement.Migrations
{ {
[DbContext(typeof(ConfectioneryDatabase))] [DbContext(typeof(ConfectioneryDatabase))]
[Migration("20240602085942_InitialMail")] [Migration("20240602112944_InitialMail")]
partial class InitialMail partial class InitialMail
{ {
/// <inheritdoc /> /// <inheritdoc />

View File

@ -0,0 +1,47 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ConfectioneryDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class InitialMail : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "MessageInfos",
columns: table => new
{
MessageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: true),
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
Body = table.Column<string>(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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "MessageInfos");
}
}
}

View File

@ -3,6 +3,7 @@ using ConfectioneryContracts.BusinessLogicsContracts;
using ConfectioneryContracts.SearchModels; using ConfectioneryContracts.SearchModels;
using ConfectioneryContracts.ViewModels; using ConfectioneryContracts.ViewModels;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Net;
namespace ConfectioneryRestApi.Controllers namespace ConfectioneryRestApi.Controllers
{ {
@ -47,7 +48,7 @@ namespace ConfectioneryRestApi.Controllers
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка регистрации"); _logger.LogError(ex, "Ошибка регистрации");
throw; Response.StatusCode = (int)HttpStatusCode.NotAcceptable;
} }
} }
[HttpPost] [HttpPost]

View File

@ -11,5 +11,5 @@
"PopHost": "pop.gmail.com", "PopHost": "pop.gmail.com",
"PopPort": "995", "PopPort": "995",
"MailLogin": "labworkalimova@gmail.com", "MailLogin": "labworkalimova@gmail.com",
"MailPassword": "labworkalimova1!" "MailPassword": "mrwi jpal mwmk gwgl"
} }

View File

@ -6,6 +6,6 @@
<add key="PopHost" value="pop.gmail.com" /> <add key="PopHost" value="pop.gmail.com" />
<add key="PopPort" value="995" /> <add key="PopPort" value="995" />
<add key="MailLogin" value="labworkalimova@gmail.com" /> <add key="MailLogin" value="labworkalimova@gmail.com" />
<add key="MailPassword" value="labworkalimova1!" /> <add key="MailPassword" value="mrwi jpal mwmk gwgl" />
</appSettings> </appSettings>
</configuration> </configuration>