diff --git a/PrecastConcretePlant/PrecastConcretePlantClientApp/Controllers/HomeController.cs b/PrecastConcretePlant/PrecastConcretePlantClientApp/Controllers/HomeController.cs index 505203a..51cf194 100644 --- a/PrecastConcretePlant/PrecastConcretePlantClientApp/Controllers/HomeController.cs +++ b/PrecastConcretePlant/PrecastConcretePlantClientApp/Controllers/HomeController.cs @@ -14,7 +14,7 @@ namespace PrecastConcretePlantClientApp.Controllers { _logger = logger; } - + public IActionResult Index() { if (APIClient.Client == null) diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Implements/ReinforcedStorage.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Implements/ReinforcedStorage.cs index 50c3dd6..1925846 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Implements/ReinforcedStorage.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Implements/ReinforcedStorage.cs @@ -19,11 +19,11 @@ namespace PrecastConcretePlantDatabaseImplement.Implements { using var context = new PrecastConcretePlantDataBase(); - var element = context.Reinforceds.Include(x => x.Components).FirstOrDefault(rec => rec.Id == model.Id); + var element = context.Reinforcedies.Include(x => x.Components).FirstOrDefault(rec => rec.Id == model.Id); if (element != null) { - context.Reinforceds.Remove(element); + context.Reinforcedies.Remove(element); context.SaveChanges(); return element.GetViewModel; } @@ -40,7 +40,7 @@ namespace PrecastConcretePlantDatabaseImplement.Implements using var context = new PrecastConcretePlantDataBase(); - return context.Reinforceds.Include(x => x.Components).ThenInclude(x => x.Component).FirstOrDefault(x => (!string.IsNullOrEmpty(model.ReinforcedName) && x.ReinforcedName == model.ReinforcedName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; + return context.Reinforcedies.Include(x => x.Components).ThenInclude(x => x.Component).FirstOrDefault(x => (!string.IsNullOrEmpty(model.ReinforcedName) && x.ReinforcedName == model.ReinforcedName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; } public List GetFilteredList(ReinforcedSearchModel model) @@ -52,14 +52,14 @@ namespace PrecastConcretePlantDatabaseImplement.Implements using var context = new PrecastConcretePlantDataBase(); - return context.Reinforceds.Include(x => x.Components).ThenInclude(x => x.Component).Where(x => x.ReinforcedName.Contains(model.ReinforcedName)).ToList().Select(x => x.GetViewModel).ToList(); + return context.Reinforcedies.Include(x => x.Components).ThenInclude(x => x.Component).Where(x => x.ReinforcedName.Contains(model.ReinforcedName)).ToList().Select(x => x.GetViewModel).ToList(); } public List GetFullList() { using var context = new PrecastConcretePlantDataBase(); - return context.Reinforceds.Include(x => x.Components).ThenInclude(x => x.Component).ToList().Select(x => x.GetViewModel).ToList(); + return context.Reinforcedies.Include(x => x.Components).ThenInclude(x => x.Component).ToList().Select(x => x.GetViewModel).ToList(); } public ReinforcedViewModel? Insert(ReinforcedBindingModel model) @@ -73,7 +73,7 @@ namespace PrecastConcretePlantDatabaseImplement.Implements return null; } - context.Reinforceds.Add(newReinforced); + context.Reinforcedies.Add(newReinforced); context.SaveChanges(); return newReinforced.GetViewModel; @@ -87,7 +87,7 @@ namespace PrecastConcretePlantDatabaseImplement.Implements try { - var reinforced = context.Reinforceds.FirstOrDefault(rec => rec.Id == model.Id); + var reinforced = context.Reinforcedies.FirstOrDefault(rec => rec.Id == model.Id); if (reinforced == null) { diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230226175226_InitMigration.Designer.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230226175226_InitMigration.Designer.cs deleted file mode 100644 index 20c2331..0000000 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230226175226_InitMigration.Designer.cs +++ /dev/null @@ -1,175 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using PrecastConcretePlantDatabaseImplement; - -#nullable disable - -namespace PrecastConcretePlantDatabaseImplement.Migrations -{ - [DbContext(typeof(PrecastConcretePlantDataBase))] - [Migration("20230226175226_InitMigration")] - partial class InitMigration - { - /// - 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("PrecastConcretePlantDatabaseImplement.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("PrecastConcretePlantDatabaseImplement.Models.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("DateCreate") - .HasColumnType("datetime2"); - - b.Property("DateImplement") - .HasColumnType("datetime2"); - - b.Property("ReinforcedId") - .HasColumnType("int"); - - b.Property("ReinforcedName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Sum") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("ReinforcedId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Reinforced", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Price") - .HasColumnType("float"); - - b.Property("ReinforcedName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Reinforceds"); - }); - - modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ReinforcedComponent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ComponentId") - .HasColumnType("int"); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("ReinforcedId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ComponentId"); - - b.HasIndex("ReinforcedId"); - - b.ToTable("ReinforcedComponents"); - }); - - modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Order", b => - { - b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Reinforced", "Reinforced") - .WithMany("Orders") - .HasForeignKey("ReinforcedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Reinforced"); - }); - - modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ReinforcedComponent", b => - { - b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Component", "Component") - .WithMany("ReinforcedComponents") - .HasForeignKey("ComponentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Reinforced", "Reinforced") - .WithMany("Components") - .HasForeignKey("ReinforcedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Component"); - - b.Navigation("Reinforced"); - }); - - modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Component", b => - { - b.Navigation("ReinforcedComponents"); - }); - - modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Reinforced", b => - { - b.Navigation("Components"); - - b.Navigation("Orders"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326163223_AddClient.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326163223_AddClient.cs deleted file mode 100644 index 9d6739a..0000000 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326163223_AddClient.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace PrecastConcretePlantDatabaseImplement.Migrations -{ - /// - public partial class AddClient : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ClientId", - table: "Orders", - type: "int", - nullable: true); - - 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.CreateIndex( - name: "IX_Orders_ClientId", - table: "Orders", - column: "ClientId"); - - migrationBuilder.AddForeignKey( - name: "FK_Orders_Clients_ClientId", - table: "Orders", - column: "ClientId", - principalTable: "Clients", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Orders_Clients_ClientId", - table: "Orders"); - - migrationBuilder.DropTable( - name: "Clients"); - - migrationBuilder.DropIndex( - name: "IX_Orders_ClientId", - table: "Orders"); - - migrationBuilder.DropColumn( - name: "ClientId", - table: "Orders"); - } - } -} diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326163223_AddClient.Designer.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326191118_Restart.Designer.cs similarity index 98% rename from PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326163223_AddClient.Designer.cs rename to PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326191118_Restart.Designer.cs index 8f8c285..7ab0208 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326163223_AddClient.Designer.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326191118_Restart.Designer.cs @@ -12,8 +12,8 @@ using PrecastConcretePlantDatabaseImplement; namespace PrecastConcretePlantDatabaseImplement.Migrations { [DbContext(typeof(PrecastConcretePlantDataBase))] - [Migration("20230326163223_AddClient")] - partial class AddClient + [Migration("20230326191118_Restart")] + partial class Restart { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -129,7 +129,7 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations b.HasKey("Id"); - b.ToTable("Reinforceds"); + b.ToTable("Reinforcedies"); }); modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ReinforcedComponent", b => diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230226175226_InitMigration.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326191118_Restart.cs similarity index 74% rename from PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230226175226_InitMigration.cs rename to PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326191118_Restart.cs index b82c188..567482c 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230226175226_InitMigration.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20230326191118_Restart.cs @@ -6,11 +6,26 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace PrecastConcretePlantDatabaseImplement.Migrations { /// - public partial class InitMigration : Migration + public partial class Restart : 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 @@ -26,7 +41,7 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations }); migrationBuilder.CreateTable( - name: "Reinforceds", + name: "Reinforcedies", columns: table => new { Id = table.Column(type: "int", nullable: false) @@ -36,7 +51,7 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations }, constraints: table => { - table.PrimaryKey("PK_Reinforceds", x => x.Id); + table.PrimaryKey("PK_Reinforcedies", x => x.Id); }); migrationBuilder.CreateTable( @@ -51,15 +66,21 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations 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) + DateImplement = table.Column(type: "datetime2", nullable: true), + ClientId = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Orders", x => x.Id); table.ForeignKey( - name: "FK_Orders_Reinforceds_ReinforcedId", + name: "FK_Orders_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Orders_Reinforcedies_ReinforcedId", column: x => x.ReinforcedId, - principalTable: "Reinforceds", + principalTable: "Reinforcedies", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -84,13 +105,18 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_ReinforcedComponents_Reinforceds_ReinforcedId", + name: "FK_ReinforcedComponents_Reinforcedies_ReinforcedId", column: x => x.ReinforcedId, - principalTable: "Reinforceds", + principalTable: "Reinforcedies", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateIndex( + name: "IX_Orders_ClientId", + table: "Orders", + column: "ClientId"); + migrationBuilder.CreateIndex( name: "IX_Orders_ReinforcedId", table: "Orders", @@ -116,11 +142,14 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations migrationBuilder.DropTable( name: "ReinforcedComponents"); + migrationBuilder.DropTable( + name: "Clients"); + migrationBuilder.DropTable( name: "Components"); migrationBuilder.DropTable( - name: "Reinforceds"); + name: "Reinforcedies"); } } } diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/PrecastConcretePlantDataBaseModelSnapshot.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/PrecastConcretePlantDataBaseModelSnapshot.cs index 78bfbfe..4ac8cd3 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/PrecastConcretePlantDataBaseModelSnapshot.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/PrecastConcretePlantDataBaseModelSnapshot.cs @@ -126,7 +126,7 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations b.HasKey("Id"); - b.ToTable("Reinforceds"); + b.ToTable("Reinforcedies"); }); modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ReinforcedComponent", b => diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Models/Reinforced.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Models/Reinforced.cs index b7978a0..1c91633 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Models/Reinforced.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Models/Reinforced.cs @@ -87,7 +87,7 @@ namespace PrecastConcretePlantDatabaseImplement.Models context.SaveChanges(); } - var reinforced = context.Reinforceds.First(x => x.Id == Id); + var reinforced = context.Reinforcedies.First(x => x.Id == Id); foreach (var pc in model.ReinforcedComponents) { diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/PrecastConcretePlantDatabaseImplement.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/PrecastConcretePlantDatabaseImplement.cs index daee8eb..5268ba2 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/PrecastConcretePlantDatabaseImplement.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/PrecastConcretePlantDatabaseImplement.cs @@ -19,7 +19,7 @@ namespace PrecastConcretePlantDatabaseImplement base.OnConfiguring(optionsBuilder); } public virtual DbSet Components { set; get; } - public virtual DbSet Reinforceds { set; get; } + public virtual DbSet Reinforcedies { set; get; } public virtual DbSet ReinforcedComponents { set; get; } public virtual DbSet Orders { set; get; } public virtual DbSet Clients { set; get; } diff --git a/PrecastConcretePlant/PrecastConcretePlantFileImplement/DataFileSingleton.cs b/PrecastConcretePlant/PrecastConcretePlantFileImplement/DataFileSingleton.cs index ba39c36..d194c32 100644 --- a/PrecastConcretePlant/PrecastConcretePlantFileImplement/DataFileSingleton.cs +++ b/PrecastConcretePlant/PrecastConcretePlantFileImplement/DataFileSingleton.cs @@ -18,7 +18,7 @@ namespace PrecastConcretePlantFileImplement private readonly string ClientFileName = "Client.xml"; public List Components { get; private set; } public List Orders { get; private set; } - public List Reinforceds { get; private set; } + public List Reinforcedies { get; private set; } public List Clients { get; private set; } public static DataFileSingleton GetInstance() { @@ -30,8 +30,8 @@ namespace PrecastConcretePlantFileImplement } public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement); - public void SaveReinforceds() => SaveData(Reinforceds, ReinforcedFileName, - "Reinforceds", x => x.GetXElement); + public void SaveReinforceds() => SaveData(Reinforcedies, ReinforcedFileName, + "Reinforcedies", x => x.GetXElement); public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement); public void SaveClients() => SaveData(Clients, OrderFileName, "Clients", x => x.GetXElement); @@ -39,7 +39,7 @@ namespace PrecastConcretePlantFileImplement { Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!; - Reinforceds = LoadData(ReinforcedFileName, "Reinforced", x => + Reinforcedies = LoadData(ReinforcedFileName, "Reinforced", x => Reinforced.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!; diff --git a/PrecastConcretePlant/PrecastConcretePlantFileImplement/Implements/ReinforcedStorage.cs b/PrecastConcretePlant/PrecastConcretePlantFileImplement/Implements/ReinforcedStorage.cs index b68cfdb..51e6159 100644 --- a/PrecastConcretePlant/PrecastConcretePlantFileImplement/Implements/ReinforcedStorage.cs +++ b/PrecastConcretePlant/PrecastConcretePlantFileImplement/Implements/ReinforcedStorage.cs @@ -22,11 +22,11 @@ namespace PrecastConcretePlantFileImplement.Implements public ReinforcedViewModel? Delete(ReinforcedBindingModel model) { - var element = source.Reinforceds.FirstOrDefault(x => x.Id == model.Id); + var element = source.Reinforcedies.FirstOrDefault(x => x.Id == model.Id); if (element != null) { - source.Reinforceds.Remove(element); + source.Reinforcedies.Remove(element); source.SaveReinforceds(); return element.GetViewModel; @@ -42,7 +42,7 @@ namespace PrecastConcretePlantFileImplement.Implements return null; } - return source.Reinforceds.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ReinforcedName) && x.ReinforcedName == model.ReinforcedName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; + return source.Reinforcedies.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ReinforcedName) && x.ReinforcedName == model.ReinforcedName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; } public List GetFilteredList(ReinforcedSearchModel model) @@ -52,17 +52,17 @@ namespace PrecastConcretePlantFileImplement.Implements return new(); } - return source.Reinforceds.Where(x => x.ReinforcedName.Contains(model.ReinforcedName)).Select(x => x.GetViewModel).ToList(); + return source.Reinforcedies.Where(x => x.ReinforcedName.Contains(model.ReinforcedName)).Select(x => x.GetViewModel).ToList(); } public List GetFullList() { - return source.Reinforceds.Select(x => x.GetViewModel).ToList(); + return source.Reinforcedies.Select(x => x.GetViewModel).ToList(); } public ReinforcedViewModel? Insert(ReinforcedBindingModel model) { - model.Id = source.Reinforceds.Count > 0 ? source.Reinforceds.Max(x => x.Id) + 1 : 1; + model.Id = source.Reinforcedies.Count > 0 ? source.Reinforcedies.Max(x => x.Id) + 1 : 1; var newReinforced = Reinforced.Create(model); if (newReinforced == null) @@ -70,7 +70,7 @@ namespace PrecastConcretePlantFileImplement.Implements return null; } - source.Reinforceds.Add(newReinforced); + source.Reinforcedies.Add(newReinforced); source.SaveReinforceds(); return newReinforced.GetViewModel; @@ -78,7 +78,7 @@ namespace PrecastConcretePlantFileImplement.Implements public ReinforcedViewModel? Update(ReinforcedBindingModel model) { - var reinforced = source.Reinforceds.FirstOrDefault(x => x.Id == model.Id); + var reinforced = source.Reinforcedies.FirstOrDefault(x => x.Id == model.Id); if (reinforced == null) { diff --git a/PrecastConcretePlant/PrecastConcretePlantFileImplement/Models/Order.cs b/PrecastConcretePlant/PrecastConcretePlantFileImplement/Models/Order.cs index 07275d8..a557d3e 100644 --- a/PrecastConcretePlant/PrecastConcretePlantFileImplement/Models/Order.cs +++ b/PrecastConcretePlant/PrecastConcretePlantFileImplement/Models/Order.cs @@ -93,7 +93,7 @@ namespace PrecastConcretePlantFileImplement.Models { Id = Id, ReinforcedId = ReinforcedId, - ReinforcedName = ReinforcedName, + ReinforcedName = DataFileSingleton.GetInstance().Reinforcedies.FirstOrDefault(x => x.Id == ReinforcedId)?.ReinforcedName ?? string.Empty, ClientFIO = DataFileSingleton.GetInstance().Clients.FirstOrDefault(x => x.Id == ClientId)?.ClientFIO ?? string.Empty, ClientId = ClientId, Count = Count, diff --git a/PrecastConcretePlant/PrecastConcretePlantListImplement/DataListSingleton.cs b/PrecastConcretePlant/PrecastConcretePlantListImplement/DataListSingleton.cs index d32b2f4..1ac1e27 100644 --- a/PrecastConcretePlant/PrecastConcretePlantListImplement/DataListSingleton.cs +++ b/PrecastConcretePlant/PrecastConcretePlantListImplement/DataListSingleton.cs @@ -12,13 +12,13 @@ namespace PrecastConcretePlantListImplement private static DataListSingleton? _instance; public List Components { get; set; } public List Orders { get; set; } - public List Reinforceds { get; set; } + public List Reinforcedies { get; set; } public List Clients { get; set; } private DataListSingleton() { Components = new List(); Orders = new List(); - Reinforceds = new List(); + Reinforcedies = new List(); Clients = new List(); } public static DataListSingleton GetInstance() diff --git a/PrecastConcretePlant/PrecastConcretePlantListImplement/Implements/OrderStorage.cs b/PrecastConcretePlant/PrecastConcretePlantListImplement/Implements/OrderStorage.cs index b53b334..da7369f 100644 --- a/PrecastConcretePlant/PrecastConcretePlantListImplement/Implements/OrderStorage.cs +++ b/PrecastConcretePlant/PrecastConcretePlantListImplement/Implements/OrderStorage.cs @@ -128,11 +128,11 @@ namespace PrecastConcretePlantListImplement.Implements private OrderViewModel GetViewModel(Order model) { var res = model.GetViewModel; - foreach (var pastry in _source.Reinforceds) + foreach (var reinforced in _source.Reinforcedies) { - if (pastry.Id == model.ReinforcedId) + if (reinforced.Id == model.ReinforcedId) { - res.ReinforcedName = pastry.ReinforcedName; + res.ReinforcedName = reinforced.ReinforcedName; break; } } diff --git a/PrecastConcretePlant/PrecastConcretePlantListImplement/Implements/ReinforcedStorage.cs b/PrecastConcretePlant/PrecastConcretePlantListImplement/Implements/ReinforcedStorage.cs index 4ab7b3e..7fb5806 100644 --- a/PrecastConcretePlant/PrecastConcretePlantListImplement/Implements/ReinforcedStorage.cs +++ b/PrecastConcretePlant/PrecastConcretePlantListImplement/Implements/ReinforcedStorage.cs @@ -22,12 +22,12 @@ namespace PrecastConcretePlantListImplement.Implements public ReinforcedViewModel? Delete(ReinforcedBindingModel model) { - for (int i = 0; i < _source.Reinforceds.Count; ++i) + for (int i = 0; i < _source.Reinforcedies.Count; ++i) { - if (_source.Reinforceds[i].Id == model.Id) + if (_source.Reinforcedies[i].Id == model.Id) { - var element = _source.Reinforceds[i]; - _source.Reinforceds.RemoveAt(i); + var element = _source.Reinforcedies[i]; + _source.Reinforcedies.RemoveAt(i); return element.GetViewModel; } } @@ -42,7 +42,7 @@ namespace PrecastConcretePlantListImplement.Implements return null; } - foreach (var reinforced in _source.Reinforceds) + foreach (var reinforced in _source.Reinforcedies) { if ((!string.IsNullOrEmpty(model.ReinforcedName) && reinforced.ReinforcedName == model.ReinforcedName) || (model.Id.HasValue && reinforced.Id == model.Id)) { @@ -62,7 +62,7 @@ namespace PrecastConcretePlantListImplement.Implements return result; } - foreach (var reinforced in _source.Reinforceds) + foreach (var reinforced in _source.Reinforcedies) { if (reinforced.ReinforcedName.Contains(model.ReinforcedName)) { @@ -77,7 +77,7 @@ namespace PrecastConcretePlantListImplement.Implements { var result = new List(); - foreach (var reinforced in _source.Reinforceds) + foreach (var reinforced in _source.Reinforcedies) { result.Add(reinforced.GetViewModel); } @@ -89,7 +89,7 @@ namespace PrecastConcretePlantListImplement.Implements { model.Id = 1; - foreach (var reinforced in _source.Reinforceds) + foreach (var reinforced in _source.Reinforcedies) { if (model.Id <= reinforced.Id) { @@ -104,14 +104,14 @@ namespace PrecastConcretePlantListImplement.Implements return null; } - _source.Reinforceds.Add(newReinforced); + _source.Reinforcedies.Add(newReinforced); return newReinforced.GetViewModel; } public ReinforcedViewModel? Update(ReinforcedBindingModel model) { - foreach (var reinforced in _source.Reinforceds) + foreach (var reinforced in _source.Reinforcedies) { if (reinforced.Id == model.Id) { diff --git a/PrecastConcretePlant/PrecastConcretePlantRestApi/Controllers/MainController.cs b/PrecastConcretePlant/PrecastConcretePlantRestApi/Controllers/MainController.cs index ece4f4a..4d45ed4 100644 --- a/PrecastConcretePlant/PrecastConcretePlantRestApi/Controllers/MainController.cs +++ b/PrecastConcretePlant/PrecastConcretePlantRestApi/Controllers/MainController.cs @@ -24,7 +24,7 @@ namespace PrecastConcretePlantRestApi.Controllers } [HttpGet] - public List? GetPastryList() + public List? GetReinforcedList() { try { @@ -38,15 +38,15 @@ namespace PrecastConcretePlantRestApi.Controllers } [HttpGet] - public ReinforcedViewModel? GetPastry(int PastryId) + public ReinforcedViewModel? GetReinforced(int ReinforcedId) { try { - return _reinforced.ReadElement(new ReinforcedSearchModel { Id = PastryId }); + return _reinforced.ReadElement(new ReinforcedSearchModel { Id = ReinforcedId }); } catch (Exception ex) { - _logger.LogError(ex, "Ошибка получения изделия по id={Id}", PastryId); + _logger.LogError(ex, "Ошибка получения изделия по id={Id}", ReinforcedId); throw; } }