пересоздала миграцию, работает то, что не работало. теперь не работает регистрация
This commit is contained in:
parent
0f556e24a2
commit
ceb0ca6390
@ -1,4 +1,4 @@
|
||||
namespace SushiBarView.Clients
|
||||
namespace SushiBarView
|
||||
{
|
||||
partial class FormClients
|
||||
{
|
||||
@ -36,47 +36,44 @@
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.BackgroundColor = Color.MintCream;
|
||||
dataGridView.BackgroundColor = Color.AntiqueWhite;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Left;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.Size = new Size(569, 450);
|
||||
dataGridView.Size = new Size(615, 450);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Location = new Point(620, 34);
|
||||
buttonRefresh.Location = new Point(669, 53);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(134, 50);
|
||||
buttonRefresh.Size = new Size(144, 54);
|
||||
buttonRefresh.TabIndex = 1;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += buttonRefresh_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Location = new Point(620, 111);
|
||||
buttonDelete.Location = new Point(669, 160);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(134, 50);
|
||||
buttonDelete.Size = new Size(144, 54);
|
||||
buttonDelete.TabIndex = 2;
|
||||
buttonDelete.Text = "Удалить";
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// FormClients
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.Beige;
|
||||
ClientSize = new Size(800, 450);
|
||||
BackColor = Color.BurlyWood;
|
||||
ClientSize = new Size(862, 450);
|
||||
Controls.Add(buttonDelete);
|
||||
Controls.Add(buttonRefresh);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormClients";
|
||||
Text = "Клиенты";
|
||||
Load += FormClients_Load;
|
||||
Text = "FormClients";
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
@ -11,7 +11,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SushiBarView.Clients
|
||||
namespace SushiBarView
|
||||
{
|
||||
public partial class FormClients : Form
|
||||
{
|
||||
@ -52,7 +52,7 @@ namespace SushiBarView.Clients
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(dataGridView.SelectedRows.Count == 1)
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Вы серьезно хотите удалить клиента? :_) та за что...", "Вопрос",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
@ -71,7 +71,7 @@ namespace SushiBarView.Clients
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Не удалось удалить клиента");
|
||||
_logger.LogError(ex.Message, "Не удалось удалить клиента");
|
@ -2,7 +2,6 @@
|
||||
using SushiBar;
|
||||
using SushiBarContracts.BindingModel;
|
||||
using SushiBarContracts.BusinessLogicsContracts;
|
||||
using SushiBarView.Clients;
|
||||
using SushiBarView.Reports;
|
||||
|
||||
namespace SushiBarView
|
||||
|
@ -9,7 +9,6 @@ using SushiBarContracts.BusinessLogicsContracts;
|
||||
using SushiBarContracts.StoragesContracts;
|
||||
using SushiBarDatabaseImplement.Implements;
|
||||
using SushiBarView;
|
||||
using SushiBarView.Clients;
|
||||
using SushiBarView.Reports;
|
||||
using System.Text;
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace SushiBarClientApp
|
||||
public static ClientViewModel? Client { get; set; } = null;
|
||||
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.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ namespace SushiBarClientApp.Controllers
|
||||
{
|
||||
throw new Exception("Ââåäèòå ëîãèí, ïàðîëü è ÔÈÎ");
|
||||
}
|
||||
APIClient.PostRequest("api/client/updatedata", new
|
||||
ClientBindingModel
|
||||
APIClient.PostRequest("api/client/updatedata", new ClientBindingModel
|
||||
{
|
||||
Id = APIClient.Client.Id,
|
||||
ClientFIO = fio,
|
||||
@ -107,8 +106,7 @@ namespace SushiBarClientApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewBag.Products =
|
||||
APIClient.GetRequest<List<SushiViewModel>>("api/main/getproductlist");
|
||||
ViewBag.Sushis = APIClient.GetRequest<List<SushiViewModel>>("api/main/getsushislist");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
@ -134,8 +132,7 @@ namespace SushiBarClientApp.Controllers
|
||||
[HttpPost]
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<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="~/css/site.css" />
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
@ -44,7 +44,7 @@
|
||||
</div>
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2020 - Абстрактный магазин - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
|
||||
© 2020 - Суши бар - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
|
@ -7,5 +7,5 @@
|
||||
},
|
||||
"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
|
||||
{
|
||||
[DbContext(typeof(SushiBarDatabase))]
|
||||
[Migration("20240405210111_migrationLab5")]
|
||||
partial class migrationLab5
|
||||
[Migration("20240406182026_InitCreate")]
|
||||
partial class InitCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -156,17 +156,21 @@ namespace SushiBarDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Client", null)
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", null)
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("SushiId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Sushi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
@ -11,7 +11,20 @@ namespace SushiBarDatabaseImplement.Migrations
|
||||
/// <inheritdoc />
|
||||
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(
|
||||
name: "Components",
|
||||
@ -48,6 +61,7 @@ namespace SushiBarDatabaseImplement.Migrations
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
SushiId = table.Column<int>(type: "int", nullable: false),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
@ -57,6 +71,12 @@ namespace SushiBarDatabaseImplement.Migrations
|
||||
constraints: table =>
|
||||
{
|
||||
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(
|
||||
name: "FK_Orders_Sushis_SushiId",
|
||||
column: x => x.SushiId,
|
||||
@ -92,6 +112,11 @@ namespace SushiBarDatabaseImplement.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_ClientId",
|
||||
table: "Orders",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_SushiId",
|
||||
table: "Orders",
|
||||
@ -117,6 +142,9 @@ namespace SushiBarDatabaseImplement.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "SushiComponents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Components");
|
||||
|
@ -153,17 +153,21 @@ namespace SushiBarDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Client", null)
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", null)
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("SushiId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Sushi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
||||
|
@ -45,7 +45,7 @@ namespace SushiBarRestApi.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения продукта по id={Id}", sushiId);
|
||||
_logger.LogError(ex, "Ошибка получения суши по id={Id}", sushiId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using SushiBarDatabaseImplement.Implements;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using SushiBarBusinessLogic.BusinessLogic;
|
||||
using SushiBarBusinessLogic;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||
builder.Logging.AddLog4Net("log4net.config");
|
||||
@ -15,16 +16,14 @@ builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||
builder.Services.AddTransient<ISushiLogic, SushiLogic>();
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at
|
||||
https://aka.ms/aspnetcore/swashbuckle
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo
|
||||
{
|
||||
Title = "SushiBarRestApi",
|
||||
Version
|
||||
= "v1"
|
||||
Version = "v1"
|
||||
});
|
||||
});
|
||||
var app = builder.Build();
|
||||
@ -32,8 +31,7 @@ var app = builder.Build();
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
|
||||
"SushiBarRestApi v1"));
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SushiBarRestApi v1"));
|
||||
}
|
||||
app.UseHttpsRedirection();
|
||||
app.UseAuthorization();
|
||||
|
Loading…
Reference in New Issue
Block a user