пересоздала миграцию, работает то, что не работало. теперь не работает регистрация
This commit is contained in:
parent
0f556e24a2
commit
ceb0ca6390
@ -1,4 +1,4 @@
|
|||||||
namespace SushiBarView.Clients
|
namespace SushiBarView
|
||||||
{
|
{
|
||||||
partial class FormClients
|
partial class FormClients
|
||||||
{
|
{
|
||||||
@ -36,47 +36,44 @@
|
|||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridView.BackgroundColor = Color.MintCream;
|
dataGridView.BackgroundColor = Color.AntiqueWhite;
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Dock = DockStyle.Left;
|
dataGridView.Dock = DockStyle.Left;
|
||||||
dataGridView.Location = new Point(0, 0);
|
dataGridView.Location = new Point(0, 0);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.Size = new Size(569, 450);
|
dataGridView.Size = new Size(615, 450);
|
||||||
dataGridView.TabIndex = 0;
|
dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// buttonRefresh
|
// buttonRefresh
|
||||||
//
|
//
|
||||||
buttonRefresh.Location = new Point(620, 34);
|
buttonRefresh.Location = new Point(669, 53);
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
buttonRefresh.Size = new Size(134, 50);
|
buttonRefresh.Size = new Size(144, 54);
|
||||||
buttonRefresh.TabIndex = 1;
|
buttonRefresh.TabIndex = 1;
|
||||||
buttonRefresh.Text = "Обновить";
|
buttonRefresh.Text = "Обновить";
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
buttonRefresh.UseVisualStyleBackColor = true;
|
||||||
buttonRefresh.Click += buttonRefresh_Click;
|
|
||||||
//
|
//
|
||||||
// buttonDelete
|
// buttonDelete
|
||||||
//
|
//
|
||||||
buttonDelete.Location = new Point(620, 111);
|
buttonDelete.Location = new Point(669, 160);
|
||||||
buttonDelete.Name = "buttonDelete";
|
buttonDelete.Name = "buttonDelete";
|
||||||
buttonDelete.Size = new Size(134, 50);
|
buttonDelete.Size = new Size(144, 54);
|
||||||
buttonDelete.TabIndex = 2;
|
buttonDelete.TabIndex = 2;
|
||||||
buttonDelete.Text = "Удалить";
|
buttonDelete.Text = "Удалить";
|
||||||
buttonDelete.UseVisualStyleBackColor = true;
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
buttonDelete.Click += buttonDelete_Click;
|
|
||||||
//
|
//
|
||||||
// FormClients
|
// FormClients
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
BackColor = Color.Beige;
|
BackColor = Color.BurlyWood;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(862, 450);
|
||||||
Controls.Add(buttonDelete);
|
Controls.Add(buttonDelete);
|
||||||
Controls.Add(buttonRefresh);
|
Controls.Add(buttonRefresh);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "FormClients";
|
Name = "FormClients";
|
||||||
Text = "Клиенты";
|
Text = "FormClients";
|
||||||
Load += FormClients_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace SushiBarView.Clients
|
namespace SushiBarView
|
||||||
{
|
{
|
||||||
public partial class FormClients : Form
|
public partial class FormClients : Form
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ namespace SushiBarView.Clients
|
|||||||
|
|
||||||
private void buttonDelete_Click(object sender, EventArgs e)
|
private void buttonDelete_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Вы серьезно хотите удалить клиента? :_) та за что...", "Вопрос",
|
if (MessageBox.Show("Вы серьезно хотите удалить клиента? :_) та за что...", "Вопрос",
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
@ -60,7 +60,7 @@ namespace SushiBarView.Clients
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
_logger.LogInformation($"Удален клиент под номером {id}");
|
_logger.LogInformation($"Удален клиент под номером {id}");
|
||||||
|
|
||||||
if (!_clientLogic.Delete(new ClientBindingModel
|
if (!_clientLogic.Delete(new ClientBindingModel
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ namespace SushiBarView.Clients
|
|||||||
}
|
}
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Не удалось удалить клиента");
|
MessageBox.Show(ex.Message, "Не удалось удалить клиента");
|
||||||
_logger.LogError(ex.Message, "Не удалось удалить клиента");
|
_logger.LogError(ex.Message, "Не удалось удалить клиента");
|
||||||
@ -85,4 +85,4 @@ namespace SushiBarView.Clients
|
|||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@
|
|||||||
using SushiBar;
|
using SushiBar;
|
||||||
using SushiBarContracts.BindingModel;
|
using SushiBarContracts.BindingModel;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
using SushiBarView.Clients;
|
|
||||||
using SushiBarView.Reports;
|
using SushiBarView.Reports;
|
||||||
|
|
||||||
namespace SushiBarView
|
namespace SushiBarView
|
||||||
|
@ -9,7 +9,6 @@ using SushiBarContracts.BusinessLogicsContracts;
|
|||||||
using SushiBarContracts.StoragesContracts;
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarDatabaseImplement.Implements;
|
using SushiBarDatabaseImplement.Implements;
|
||||||
using SushiBarView;
|
using SushiBarView;
|
||||||
using SushiBarView.Clients;
|
|
||||||
using SushiBarView.Reports;
|
using SushiBarView.Reports;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ namespace SushiBarClientApp
|
|||||||
public static ClientViewModel? Client { get; set; } = null;
|
public static ClientViewModel? Client { get; set; } = null;
|
||||||
public static void Connect(IConfiguration configuration)
|
public static void Connect(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
_client.BaseAddress = new Uri("http://localhost:5262/");
|
||||||
_client.DefaultRequestHeaders.Accept.Clear();
|
_client.DefaultRequestHeaders.Accept.Clear();
|
||||||
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,7 @@ namespace SushiBarClientApp.Controllers
|
|||||||
{
|
{
|
||||||
throw new Exception("Ââåäèòå ëîãèí, ïàðîëü è ÔÈÎ");
|
throw new Exception("Ââåäèòå ëîãèí, ïàðîëü è ÔÈÎ");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest("api/client/updatedata", new
|
APIClient.PostRequest("api/client/updatedata", new ClientBindingModel
|
||||||
ClientBindingModel
|
|
||||||
{
|
{
|
||||||
Id = APIClient.Client.Id,
|
Id = APIClient.Client.Id,
|
||||||
ClientFIO = fio,
|
ClientFIO = fio,
|
||||||
@ -107,8 +106,7 @@ namespace SushiBarClientApp.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
ViewBag.Products =
|
ViewBag.Sushis = APIClient.GetRequest<List<SushiViewModel>>("api/main/getsushislist");
|
||||||
APIClient.GetRequest<List<SushiViewModel>>("api/main/getproductlist");
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -134,8 +132,7 @@ namespace SushiBarClientApp.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public double Calc(int count, int sushi)
|
public double Calc(int count, int sushi)
|
||||||
{
|
{
|
||||||
var sush = APIClient.GetRequest<SushiViewModel>($"api/main/getproduct?sushiId={sushi}"
|
var sush = APIClient.GetRequest<SushiViewModel>($"api/main/getsushi?sushiId={sushi}");
|
||||||
);
|
|
||||||
return count * (sush?.Price ?? 1);
|
return count * (sush?.Price ?? 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - AbstractShowClientApp</title>
|
<title>@ViewData["Title"] - SushiBarClientApp</title>
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||||
<link rel="stylesheet" href="~/css/site.css" />
|
<link rel="stylesheet" href="~/css/site.css" />
|
||||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<footer class="border-top footer text-muted">
|
<footer class="border-top footer text-muted">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
© 2020 - Абстрактный магазин - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
|
© 2020 - Суши бар - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
|
|
||||||
"IPAddress": "http://localhost:52622"
|
"IPAddress": "http://localhost:5262/"
|
||||||
}
|
}
|
||||||
|
@ -1,169 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using SushiBarDatabaseImplement;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace SushiBarDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(SushiBarDatabase))]
|
|
||||||
[Migration("20240310073215_InitCreate")]
|
|
||||||
partial class InitCreate
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.2")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ComponentName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Cost")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Components");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("DateImplement")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<int>("SushiId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("SushiId");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<string>("SushiName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Sushis");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("ComponentId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("SushiId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ComponentId");
|
|
||||||
|
|
||||||
b.HasIndex("SushiId");
|
|
||||||
|
|
||||||
b.ToTable("SushiComponents");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", null)
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("SushiId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Component", "Component")
|
|
||||||
.WithMany("SushiComponents")
|
|
||||||
.HasForeignKey("ComponentId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
|
||||||
.WithMany("Components")
|
|
||||||
.HasForeignKey("SushiId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Component");
|
|
||||||
|
|
||||||
b.Navigation("Sushi");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("SushiComponents");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Components");
|
|
||||||
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace SushiBarDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class migrationLab5 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,8 +12,8 @@ using SushiBarDatabaseImplement;
|
|||||||
namespace SushiBarDatabaseImplement.Migrations
|
namespace SushiBarDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(SushiBarDatabase))]
|
[DbContext(typeof(SushiBarDatabase))]
|
||||||
[Migration("20240405210111_migrationLab5")]
|
[Migration("20240406182026_InitCreate")]
|
||||||
partial class migrationLab5
|
partial class InitCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -156,17 +156,21 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Client", null)
|
b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("ClientId")
|
.HasForeignKey("ClientId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", null)
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("SushiId")
|
.HasForeignKey("SushiId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
@ -11,7 +11,20 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Clients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Components",
|
name: "Components",
|
||||||
@ -48,6 +61,7 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
SushiId = table.Column<int>(type: "int", nullable: false),
|
SushiId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||||
Count = table.Column<int>(type: "int", nullable: false),
|
Count = table.Column<int>(type: "int", nullable: false),
|
||||||
Sum = table.Column<double>(type: "float", nullable: false),
|
Sum = table.Column<double>(type: "float", nullable: false),
|
||||||
Status = table.Column<int>(type: "int", nullable: false),
|
Status = table.Column<int>(type: "int", nullable: false),
|
||||||
@ -57,6 +71,12 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Orders", x => x.Id);
|
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Orders_Sushis_SushiId",
|
name: "FK_Orders_Sushis_SushiId",
|
||||||
column: x => x.SushiId,
|
column: x => x.SushiId,
|
||||||
@ -92,6 +112,11 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ClientId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Orders_SushiId",
|
name: "IX_Orders_SushiId",
|
||||||
table: "Orders",
|
table: "Orders",
|
||||||
@ -117,6 +142,9 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "SushiComponents");
|
name: "SushiComponents");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Clients");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Components");
|
name: "Components");
|
||||||
|
|
@ -153,17 +153,21 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Client", null)
|
b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("ClientId")
|
.HasForeignKey("ClientId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", null)
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("SushiId")
|
.HasForeignKey("SushiId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
||||||
|
@ -45,7 +45,7 @@ namespace SushiBarRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка получения продукта по id={Id}", sushiId);
|
_logger.LogError(ex, "Ошибка получения суши по id={Id}", sushiId);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ using SushiBarDatabaseImplement.Implements;
|
|||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using SushiBarBusinessLogic.BusinessLogic;
|
using SushiBarBusinessLogic.BusinessLogic;
|
||||||
using SushiBarBusinessLogic;
|
using SushiBarBusinessLogic;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||||
builder.Logging.AddLog4Net("log4net.config");
|
builder.Logging.AddLog4Net("log4net.config");
|
||||||
@ -15,16 +16,14 @@ builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
|||||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
builder.Services.AddTransient<ISushiLogic, SushiLogic>();
|
builder.Services.AddTransient<ISushiLogic, SushiLogic>();
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
https://aka.ms/aspnetcore/swashbuckle
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen(c =>
|
builder.Services.AddSwaggerGen(c =>
|
||||||
{
|
{
|
||||||
c.SwaggerDoc("v1", new OpenApiInfo
|
c.SwaggerDoc("v1", new OpenApiInfo
|
||||||
{
|
{
|
||||||
Title = "SushiBarRestApi",
|
Title = "SushiBarRestApi",
|
||||||
Version
|
Version = "v1"
|
||||||
= "v1"
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
@ -32,8 +31,7 @@ var app = builder.Build();
|
|||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SushiBarRestApi v1"));
|
||||||
"SushiBarRestApi v1"));
|
|
||||||
}
|
}
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
Loading…
Reference in New Issue
Block a user