не подключается((

This commit is contained in:
Андрей Байгулов 2024-05-03 19:59:17 +04:00
parent 30b88ac855
commit 82ce903155
8 changed files with 120 additions and 13 deletions

View File

@ -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>
@ -13,7 +13,7 @@
<header> <header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3"> <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
<div class="container"> <div class="container">
<a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">Абстрактный магазин</a> <a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">Суши бар</a>
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent" <button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation"> aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
@ -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">
&copy; 2020 - Абстрактный магазин - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a> &copy; 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>

View File

@ -6,6 +6,6 @@
} }
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"IPAddress": "https://localhost:7119;http://localhost:5279" "IPAddress": "http://localhost:5279/"
} }

View File

@ -12,19 +12,44 @@ using SushiBarDatabaseImplement;
namespace SushiBarDatabaseImplement.Migrations namespace SushiBarDatabaseImplement.Migrations
{ {
[DbContext(typeof(SushiBarDatabase))] [DbContext(typeof(SushiBarDatabase))]
[Migration("20240328181724_InitialCreate")] [Migration("20240503155415_Initial")]
partial class InitialCreate partial class Initial
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("SushiVersion", "7.0.17") .HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SushiBarDatabaseImplement.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b => modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -53,6 +78,9 @@ namespace SushiBarDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<int>("Count") b.Property<int>("Count")
.HasColumnType("int"); .HasColumnType("int");
@ -73,6 +101,8 @@ namespace SushiBarDatabaseImplement.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("SushiId"); b.HasIndex("SushiId");
b.ToTable("Orders"); b.ToTable("Orders");
@ -126,6 +156,10 @@ namespace SushiBarDatabaseImplement.Migrations
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b => modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
{ {
b.HasOne("SushiBarDatabaseImplement.Client", null)
.WithMany("Orders")
.HasForeignKey("ClientId");
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi") b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
.WithMany("Orders") .WithMany("Orders")
.HasForeignKey("SushiId") .HasForeignKey("SushiId")
@ -154,6 +188,11 @@ namespace SushiBarDatabaseImplement.Migrations
b.Navigation("Sushi"); b.Navigation("Sushi");
}); });
modelBuilder.Entity("SushiBarDatabaseImplement.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b => modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
{ {
b.Navigation("SushiComponents"); b.Navigation("SushiComponents");

View File

@ -6,11 +6,26 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace SushiBarDatabaseImplement.Migrations namespace SushiBarDatabaseImplement.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class InitialCreate : Migration public partial class Initial : Migration
{ {
/// <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",
columns: table => new columns: table => new
@ -50,11 +65,17 @@ namespace SushiBarDatabaseImplement.Migrations
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),
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false), DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true) DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true),
ClientId = table.Column<int>(type: "int", nullable: true)
}, },
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");
table.ForeignKey( table.ForeignKey(
name: "FK_Orders_Sushis_SushiId", name: "FK_Orders_Sushis_SushiId",
column: x => x.SushiId, column: x => x.SushiId,
@ -90,6 +111,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",
@ -115,6 +141,9 @@ namespace SushiBarDatabaseImplement.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "SushiComponents"); name: "SushiComponents");
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Components"); name: "Components");

View File

@ -17,11 +17,36 @@ namespace SushiBarDatabaseImplement.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("SushiVersion", "7.0.17") .HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SushiBarDatabaseImplement.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b => modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -50,6 +75,9 @@ namespace SushiBarDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<int>("Count") b.Property<int>("Count")
.HasColumnType("int"); .HasColumnType("int");
@ -70,6 +98,8 @@ namespace SushiBarDatabaseImplement.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("SushiId"); b.HasIndex("SushiId");
b.ToTable("Orders"); b.ToTable("Orders");
@ -123,6 +153,10 @@ namespace SushiBarDatabaseImplement.Migrations
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b => modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
{ {
b.HasOne("SushiBarDatabaseImplement.Client", null)
.WithMany("Orders")
.HasForeignKey("ClientId");
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi") b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
.WithMany("Orders") .WithMany("Orders")
.HasForeignKey("SushiId") .HasForeignKey("SushiId")
@ -151,6 +185,11 @@ namespace SushiBarDatabaseImplement.Migrations
b.Navigation("Sushi"); b.Navigation("Sushi");
}); });
modelBuilder.Entity("SushiBarDatabaseImplement.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b => modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
{ {
b.Navigation("SushiComponents"); b.Navigation("SushiComponents");

View File

@ -14,7 +14,7 @@ namespace SushiBarDatabaseImplement
{ {
if (!optionsBuilder.IsConfigured) if (!optionsBuilder.IsConfigured)
{ {
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=SushiBarDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=SushiBarDatabaseFull5lab;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
} }

View File

@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using SushiBarContracts.BindingModels; using SushiBarContracts.BindingModels;
using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
namespace AbstractShopRestApi.Controllers namespace SushiBarRestApi.Controllers
{ {
[Route("api/[controller]/[action]")] [Route("api/[controller]/[action]")]
[ApiController] [ApiController]

View File

@ -4,7 +4,7 @@ using SushiBarContracts.BindingModels;
using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.SearchModels; using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
namespace AbstractShopRestApi.Controllers namespace SushiBarRestApi.Controllers
{ {
[Route("api/[controller]/[action]")] [Route("api/[controller]/[action]")]
[ApiController] [ApiController]