diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index 4260de0..429128b 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -17,11 +17,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarFileImplement", "Su EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDatabaseImplement", "SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj", "{4E59EEFE-0146-4AFB-BA8C-18F2D8F8D22D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarRestApi", "SushiBarRestApi\SushiBarRestApi.csproj", "{0ADB6C71-701C-43A7-869C-A92D7C36C4EC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarRestApi", "SushiBarRestApi\SushiBarRestApi.csproj", "{0ADB6C71-701C-43A7-869C-A92D7C36C4EC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarClientApi", "SushiBarClientApi\SushiBarClientApi.csproj", "{BF58D50B-0408-4124-8CD3-1D5DFEE83104}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarClientApi", "SushiBarClientApi\SushiBarClientApi.csproj", "{BF58D50B-0408-4124-8CD3-1D5DFEE83104}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarStoresMvc", "SushiBarStoresMvc\SushiBarStoresMvc.csproj", "{7D14BA90-5923-45CE-9245-EB6686B5B8F6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarStoresMvc", "SushiBarStoresMvc\SushiBarStoresMvc.csproj", "{7D14BA90-5923-45CE-9245-EB6686B5B8F6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/StoreLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/StoreLogic.cs index 75113b6..5769408 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/StoreLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/StoreLogic.cs @@ -109,7 +109,7 @@ namespace SushiBarBusinessLogic.BusinessLogics } _logger.LogInformation("Shop element found. ID: {0}, Name: {1}", store.Id, store.StoreName); - int countSushi = store.Sushis.Sum(s => s.Value.Item2); + var countSushi = store.Sushis.Sum(s => s.Value.Item2); if (store.maxSushi - countSushi >= quantity) { if (store.Sushis.TryGetValue(sushi.Id, out var pair)) diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20230425050030_lab5hard.Designer.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20230425050030_lab5hard.Designer.cs new file mode 100644 index 0000000..a9c1399 --- /dev/null +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20230425050030_lab5hard.Designer.cs @@ -0,0 +1,290 @@ +// +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("20230425050030_lab5hard")] + partial class lab5hard + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientFio") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Cost") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Components"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.Property("SushiId") + .HasColumnType("int"); + + b.Property("SushiName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("SushiId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Store", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("OpeningDate") + .HasColumnType("datetime2"); + + b.Property("StoreAddress") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StoreName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("maxSushi") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Stores"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.StoreSushi", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("StoreId") + .HasColumnType("int"); + + b.Property("SushiId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("StoreId"); + + b.HasIndex("SushiId"); + + b.ToTable("StoreSushis"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("float"); + + b.Property("SushiName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Sushi"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("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.Client", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi") + .WithMany("Orders") + .HasForeignKey("SushiId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Sushi"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.StoreSushi", b => + { + b.HasOne("SushiBarDatabaseImplement.Models.Store", "Store") + .WithMany("StoreSushi") + .HasForeignKey("StoreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi") + .WithMany() + .HasForeignKey("SushiId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Store"); + + b.Navigation("Sushi"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b => + { + b.HasOne("SushiBarDatabaseImplement.Models.Component", "Component") + .WithMany("SushiComponent") + .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("SushiComponent"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Store", b => + { + b.Navigation("StoreSushi"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b => + { + b.Navigation("Components"); + + b.Navigation("Orders"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20230425050030_lab5hard.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20230425050030_lab5hard.cs new file mode 100644 index 0000000..dc00d16 --- /dev/null +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20230425050030_lab5hard.cs @@ -0,0 +1,215 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SushiBarDatabaseImplement.Migrations +{ + /// + public partial class lab5hard : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Clients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientFio = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Clients", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Components", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ComponentName = table.Column(type: "nvarchar(max)", nullable: false), + Cost = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Components", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Stores", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + StoreName = table.Column(type: "nvarchar(max)", nullable: false), + StoreAddress = table.Column(type: "nvarchar(max)", nullable: false), + OpeningDate = table.Column(type: "datetime2", nullable: false), + maxSushi = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Stores", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Sushi", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SushiName = table.Column(type: "nvarchar(max)", nullable: false), + Price = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Sushi", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Orders", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SushiId = table.Column(type: "int", nullable: false), + ClientId = table.Column(type: "int", nullable: false), + SushiName = table.Column(type: "nvarchar(max)", nullable: false), + Count = table.Column(type: "int", nullable: false), + Sum = table.Column(type: "float", nullable: false), + Status = table.Column(type: "int", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateImplement = table.Column(type: "datetime2", nullable: true) + }, + 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_Sushi_SushiId", + column: x => x.SushiId, + principalTable: "Sushi", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StoreSushis", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SushiId = table.Column(type: "int", nullable: false), + StoreId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StoreSushis", x => x.Id); + table.ForeignKey( + name: "FK_StoreSushis_Stores_StoreId", + column: x => x.StoreId, + principalTable: "Stores", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StoreSushis_Sushi_SushiId", + column: x => x.SushiId, + principalTable: "Sushi", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SushiComponents", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SushiId = table.Column(type: "int", nullable: false), + ComponentId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SushiComponents", x => x.Id); + table.ForeignKey( + name: "FK_SushiComponents_Components_ComponentId", + column: x => x.ComponentId, + principalTable: "Components", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SushiComponents_Sushi_SushiId", + column: x => x.SushiId, + principalTable: "Sushi", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Orders_ClientId", + table: "Orders", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_Orders_SushiId", + table: "Orders", + column: "SushiId"); + + migrationBuilder.CreateIndex( + name: "IX_StoreSushis_StoreId", + table: "StoreSushis", + column: "StoreId"); + + migrationBuilder.CreateIndex( + name: "IX_StoreSushis_SushiId", + table: "StoreSushis", + column: "SushiId"); + + migrationBuilder.CreateIndex( + name: "IX_SushiComponents_ComponentId", + table: "SushiComponents", + column: "ComponentId"); + + migrationBuilder.CreateIndex( + name: "IX_SushiComponents_SushiId", + table: "SushiComponents", + column: "SushiId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Orders"); + + migrationBuilder.DropTable( + name: "StoreSushis"); + + migrationBuilder.DropTable( + name: "SushiComponents"); + + migrationBuilder.DropTable( + name: "Clients"); + + migrationBuilder.DropTable( + name: "Stores"); + + migrationBuilder.DropTable( + name: "Components"); + + migrationBuilder.DropTable( + name: "Sushi"); + } + } +} diff --git a/SushiBar/SushiBarStoreApi/ApiStores.cs b/SushiBar/SushiBarStoreApi/ApiStores.cs new file mode 100644 index 0000000..03fe47b --- /dev/null +++ b/SushiBar/SushiBarStoreApi/ApiStores.cs @@ -0,0 +1,46 @@ +using System.Net.Http.Headers; +using System.Text; +using Newtonsoft.Json; + +namespace SushiBarStoreApi; + +public static class ApiStores +{ + private static readonly HttpClient _client = new(); + private static string _password = string.Empty; + public static bool Access { get; private set; } + + public static void Connect(IConfiguration configuration) + { + _password = configuration["PasswordStore"]; + _client.BaseAddress = new Uri(configuration["IPAddress"]); + _client.DefaultRequestHeaders.Accept.Clear(); + _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + } + public static T? GetRequest(string requestUrl) + { + var response = _client.GetAsync(requestUrl); + var result = response.Result.Content.ReadAsStringAsync().Result; + if (response.Result.IsSuccessStatusCode) + { + return JsonConvert.DeserializeObject(result); + } + throw new Exception(result); + } + public static void PostRequest(string requestUrl, T model) + { + var json = JsonConvert.SerializeObject(model); + var data = new StringContent(json, Encoding.UTF8,"application/json"); + var response = _client.PostAsync(requestUrl, data); + var result = response.Result.Content.ReadAsStringAsync().Result; + if (!response.Result.IsSuccessStatusCode) + { + throw new Exception(result); + } + } + + public static void GetAccess(string password) + { + Access = _password == password; + } +} \ No newline at end of file diff --git a/SushiBar/SushiBarStoreApi/Views/Home/Create.cshtml b/SushiBar/SushiBarStoreApi/Views/Home/Create.cshtml new file mode 100644 index 0000000..9c7c61e --- /dev/null +++ b/SushiBar/SushiBarStoreApi/Views/Home/Create.cshtml @@ -0,0 +1 @@ +

ABOBA

\ No newline at end of file diff --git a/SushiBar/SushiBarStoreApi/Views/Home/Delete.cshtml b/SushiBar/SushiBarStoreApi/Views/Home/Delete.cshtml new file mode 100644 index 0000000..e69de29 diff --git a/SushiBar/SushiBarStoreApi/Views/Home/Enter.cshtml b/SushiBar/SushiBarStoreApi/Views/Home/Enter.cshtml new file mode 100644 index 0000000..7c09385 --- /dev/null +++ b/SushiBar/SushiBarStoreApi/Views/Home/Enter.cshtml @@ -0,0 +1,18 @@ +@{ + ViewData["Title"] = "Enter"; +} +
+

Sign in

+
+
+
+
Password:
+
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/SushiBar/SushiBarStoreApi/Views/Home/Index.cshtml b/SushiBar/SushiBarStoreApi/Views/Home/Index.cshtml new file mode 100644 index 0000000..378bcad --- /dev/null +++ b/SushiBar/SushiBarStoreApi/Views/Home/Index.cshtml @@ -0,0 +1,8 @@ +@{ + ViewData["Title"] = "Home Page"; +} + +
+

Welcome

+

Learn about building Web apps with ASP.NET Core.

+
\ No newline at end of file diff --git a/SushiBar/SushiBarStoreApi/Views/Home/Privacy.cshtml b/SushiBar/SushiBarStoreApi/Views/Home/Privacy.cshtml new file mode 100644 index 0000000..e6eef70 --- /dev/null +++ b/SushiBar/SushiBarStoreApi/Views/Home/Privacy.cshtml @@ -0,0 +1,6 @@ +@{ + ViewData["Title"] = "Privacy Policy"; +} +

@ViewData["Title"]

+ +

Use this page to detail your site's privacy policy.

\ No newline at end of file diff --git a/SushiBar/SushiBarStoreApi/Views/Home/Supply.cshtml b/SushiBar/SushiBarStoreApi/Views/Home/Supply.cshtml new file mode 100644 index 0000000..e69de29 diff --git a/SushiBar/SushiBarStoreApi/Views/Home/Update.cshtml b/SushiBar/SushiBarStoreApi/Views/Home/Update.cshtml new file mode 100644 index 0000000..e69de29 diff --git a/SushiBar/SushiBarStoresMvc/Controllers/HomeController.cs b/SushiBar/SushiBarStoresMvc/Controllers/HomeController.cs index 51e3aa2..c77ca13 100644 --- a/SushiBar/SushiBarStoresMvc/Controllers/HomeController.cs +++ b/SushiBar/SushiBarStoresMvc/Controllers/HomeController.cs @@ -9,20 +9,13 @@ namespace SushiBarStoresMvc.Controllers; public class HomeController : Controller { - private readonly ILogger _logger; - - public HomeController(ILogger logger) - { - _logger = logger; - } - public IActionResult Index() { if (!ApiStores.Access) { return Redirect("~/Home/Enter"); } - return View(ApiStores.GetRequest>($"api/Store/GetStores")); + return View(ApiStores.GetRequest>("api/Store/GetStores")); } [HttpGet] @@ -109,7 +102,7 @@ public class HomeController : Controller [HttpGet] public IActionResult Update() { - if (ApiStores.Access == false) + if (!ApiStores.Access) { return Redirect("~/Home/Enter"); } @@ -120,7 +113,7 @@ public class HomeController : Controller [HttpPost] public void Update(int store, string name, string address, DateTime date, int count) { - if (ApiStores.Access == false) + if (!ApiStores.Access) { throw new Exception("Need auth"); } @@ -150,7 +143,7 @@ public class HomeController : Controller [HttpGet] public Tuple? GetStore(int storeId) { - if (ApiStores.Access == false) + if (!ApiStores.Access) { throw new Exception("Need auth"); } @@ -169,25 +162,25 @@ public class HomeController : Controller public IActionResult Supply() { - if (ApiStores.Access == false) + if (!ApiStores.Access) { return Redirect("~/Home/Enter"); } - ViewBag.Stores = ApiStores.GetRequest>("api/store/GetStores"); - ViewBag.Packages = ApiStores.GetRequest>("api/main/GetSushiList"); + ViewBag.Stores = ApiStores.GetRequest>("api/Store/GetStores"); + ViewBag.Sushi = ApiStores.GetRequest>("api/Main/GetProductList"); return View(); } [HttpPost] - public void Supply(int store, int package, int count) + public void Supply(int store, int sushi, int count) { - if (ApiStores.Access == false) + if (!ApiStores.Access) { throw new Exception("Need auth"); } ApiStores.PostRequest("api/store/Supply", Tuple.Create( new StoreSearchModel { Id = store }, - new SushiViewModel { Id = package }, + new SushiViewModel { Id = sushi }, count )); Response.Redirect("Index"); diff --git a/SushiBar/SushiBarStoresMvc/Views/Home/Create.cshtml b/SushiBar/SushiBarStoresMvc/Views/Home/Create.cshtml index 9c7c61e..bdf8f25 100644 --- a/SushiBar/SushiBarStoresMvc/Views/Home/Create.cshtml +++ b/SushiBar/SushiBarStoresMvc/Views/Home/Create.cshtml @@ -1 +1,31 @@ -

ABOBA

\ No newline at end of file +@{ + ViewData["Title"] = "Create"; +} +
+

Create

+
+ +
+
+
Name:
+
+
+
+
Address:
+
+
+
+
Max sushi:
+
+
+
+
Date opening:
+
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/SushiBar/SushiBarStoresMvc/Views/Home/Delete.cshtml b/SushiBar/SushiBarStoresMvc/Views/Home/Delete.cshtml index e69de29..55177bd 100644 --- a/SushiBar/SushiBarStoresMvc/Views/Home/Delete.cshtml +++ b/SushiBar/SushiBarStoresMvc/Views/Home/Delete.cshtml @@ -0,0 +1,18 @@ +@{ + ViewData["Title"] = "Delete"; +} +
+

Delete store

+
+
+
+
Store:
+
+ +
+
+
+
+
+
+
\ No newline at end of file diff --git a/SushiBar/SushiBarStoresMvc/Views/Home/Index.cshtml b/SushiBar/SushiBarStoresMvc/Views/Home/Index.cshtml index 378bcad..32151a1 100644 --- a/SushiBar/SushiBarStoresMvc/Views/Home/Index.cshtml +++ b/SushiBar/SushiBarStoresMvc/Views/Home/Index.cshtml @@ -1,8 +1,60 @@ -@{ +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model List + +@{ ViewData["Title"] = "Home Page"; }
-

Welcome

-

Learn about building Web apps with ASP.NET Core.

+

Stores

+
+ + +
+ @{ + +

+ Create + Edit + Delete + Supply +

+ + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + } + +
+ Name + + Address + + Date opening + + Max sushi +
+ @Html.DisplayFor(modelItem => item.StoreName) + + @Html.DisplayFor(modelItem => item.StoreAddress) + + @Html.DisplayFor(modelItem => item.OpeningDate) + + @Html.DisplayFor(modelItem => item.maxSushi) +
+ }
\ No newline at end of file diff --git a/SushiBar/SushiBarStoresMvc/Views/Home/Supply.cshtml b/SushiBar/SushiBarStoresMvc/Views/Home/Supply.cshtml index e69de29..1dcf537 100644 --- a/SushiBar/SushiBarStoresMvc/Views/Home/Supply.cshtml +++ b/SushiBar/SushiBarStoresMvc/Views/Home/Supply.cshtml @@ -0,0 +1,37 @@ +@{ + ViewData["Title"] = "Create"; +} + +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model Dictionary + +
+

Add sushi to store

+
+ +
+
+
Store:
+
+ +
+
+
+
Sushi:
+
+ +
+
+
+
Count:
+
+ +
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/SushiBar/SushiBarStoresMvc/Views/Home/Update.cshtml b/SushiBar/SushiBarStoresMvc/Views/Home/Update.cshtml index e69de29..8c595d5 100644 --- a/SushiBar/SushiBarStoresMvc/Views/Home/Update.cshtml +++ b/SushiBar/SushiBarStoresMvc/Views/Home/Update.cshtml @@ -0,0 +1,79 @@ +@{ + ViewData["Title"] = "Update"; +} + +
+

Edit store

+
+
+
+
Store:
+
+ +
+
+
+
Name:
+
+
+
+
Address:
+
+
+
+
Date opening:
+
+
+
+
Max sushi:
+
+
+ + + + + + + + + + + +
+ Sushi + + Count +
+
+
+
+
+
+ + +@section Scripts + { + +} \ No newline at end of file diff --git a/SushiBar/SushiBarStoresMvc/Views/Shared/_Layout.cshtml b/SushiBar/SushiBarStoresMvc/Views/Shared/_Layout.cshtml index c9b4e60..dafdae6 100644 --- a/SushiBar/SushiBarStoresMvc/Views/Shared/_Layout.cshtml +++ b/SushiBar/SushiBarStoresMvc/Views/Shared/_Layout.cshtml @@ -17,16 +17,6 @@ aria-expanded="false" aria-label="Toggle navigation"> - diff --git a/SushiBar/SushiBarStoresMvc/appsettings.json b/SushiBar/SushiBarStoresMvc/appsettings.json index f3d5839..f90c313 100644 --- a/SushiBar/SushiBarStoresMvc/appsettings.json +++ b/SushiBar/SushiBarStoresMvc/appsettings.json @@ -6,7 +6,6 @@ } }, "AllowedHosts": "*", - - "IPAddress": "https://localhost:5168/", + "IPAddress": "http://localhost:5168/", "PasswordStore": "123" }