diff --git a/CarCenter/CarCenterBusinessLogic/BusinessLogics/SaleLogic.cs b/CarCenter/CarCenterBusinessLogic/BusinessLogics/SaleLogic.cs index 51150cd..c813623 100644 --- a/CarCenter/CarCenterBusinessLogic/BusinessLogics/SaleLogic.cs +++ b/CarCenter/CarCenterBusinessLogic/BusinessLogics/SaleLogic.cs @@ -100,7 +100,7 @@ namespace CarCenterBusinessLogic.BusinessLogics { throw new InvalidOperationException("Сумма не может быть отрицательной"); } - _logger.LogInformation("Sale. SaleDateTime:{SaleDateTime}. Sum:{Sum}. CarId:{CarId}. ReceiptId:{ReceiptId}. ConfigurationId:{ConfigurationId}. Id:{Id}", model.SaleDateTime, model.Sum, model.CarId, model.ReceiptId, model.ConfigurationId, model.Id); + _logger.LogInformation("Sale. SaleDateTime:{SaleDateTime}. Sum:{Sum}. CarId:{CarId}. Id:{Id}", model.SaleDateTime, model.Sum, model.CarId, model.Id); } } } diff --git a/CarCenter/CarCenterContracts/BindingModels/PresaleBindingModel.cs b/CarCenter/CarCenterContracts/BindingModels/PresaleBindingModel.cs index 847f236..2850174 100644 --- a/CarCenter/CarCenterContracts/BindingModels/PresaleBindingModel.cs +++ b/CarCenter/CarCenterContracts/BindingModels/PresaleBindingModel.cs @@ -10,6 +10,7 @@ namespace CarCenterContracts.BindingModels public class PresaleBindingModel : IPresaleModel { public int EmployeeId { get; set; } + public String Name { get; set; } public DateTime PresaleDate { get; set; } = DateTime.Now; diff --git a/CarCenter/CarCenterContracts/BindingModels/SaleBindingModel.cs b/CarCenter/CarCenterContracts/BindingModels/SaleBindingModel.cs index 5607f6f..e730804 100644 --- a/CarCenter/CarCenterContracts/BindingModels/SaleBindingModel.cs +++ b/CarCenter/CarCenterContracts/BindingModels/SaleBindingModel.cs @@ -15,10 +15,6 @@ namespace CarCenterContracts.BindingModels public DateTime SaleDateTime { get; set; } = DateTime.Now; public int CarId { get; set; } - - public int ReceiptId { get; set; } - - public int ConfigurationId { get; set; } public int EmployeeId { get; set; } } } diff --git a/CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs b/CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs index e17e713..88292aa 100644 --- a/CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs +++ b/CarCenter/CarCenterContracts/ViewModels/PresaleViewModel.cs @@ -16,6 +16,8 @@ namespace CarCenterContracts.ViewModels [DisplayName("Номер работника")] public int EmployeeId { get; set; } + [DisplayName("Название")] + public String Name { get; set; } [DisplayName("ФИО работника")] public int? TypeOfJobId { get; set; } [DisplayName("Название вида работы")] diff --git a/CarCenter/CarCenterContracts/ViewModels/SaleViewModel.cs b/CarCenter/CarCenterContracts/ViewModels/SaleViewModel.cs index 52b8776..e533a8b 100644 --- a/CarCenter/CarCenterContracts/ViewModels/SaleViewModel.cs +++ b/CarCenter/CarCenterContracts/ViewModels/SaleViewModel.cs @@ -18,12 +18,6 @@ namespace CarCenterContracts.ViewModels public DateTime SaleDateTime {get; set;} = DateTime.Now; [DisplayName("Номер машины")] public int CarId {get; set;} - - [DisplayName("Номер поступления")] - public int ReceiptId {get; set;} - public int ConfigurationId { get; set; } - [DisplayName("Название комплектации")] - public string ConfigurationName { get; set; } = string.Empty; public int EmployeeId { get; set; } [DisplayName("ФИО работника")] public string EmployeeName { get; set; } = string.Empty; diff --git a/CarCenter/CarCenterDataModels/Models/IPresaleModel.cs b/CarCenter/CarCenterDataModels/Models/IPresaleModel.cs index bb03b51..1bb75d7 100644 --- a/CarCenter/CarCenterDataModels/Models/IPresaleModel.cs +++ b/CarCenter/CarCenterDataModels/Models/IPresaleModel.cs @@ -8,6 +8,7 @@ namespace CarCenterDataModels.Models { public interface IPresaleModel : IId { + String Name {get;} DateTime PresaleDate { get; } int EmployeeId { get; } int? TypeOfJobId { get; } diff --git a/CarCenter/CarCenterDataModels/Models/ISaleModel.cs b/CarCenter/CarCenterDataModels/Models/ISaleModel.cs index 6505fb3..1c323a6 100644 --- a/CarCenter/CarCenterDataModels/Models/ISaleModel.cs +++ b/CarCenter/CarCenterDataModels/Models/ISaleModel.cs @@ -12,7 +12,5 @@ namespace CarCenterDataModels.Models DateTime SaleDateTime { get; } int CarId { get; } int EmployeeId { get; } - int ReceiptId { get; } - int ConfigurationId { get; } } } diff --git a/CarCenter/CarCenterDatabaseImplement/Implements/SaleStorage.cs b/CarCenter/CarCenterDatabaseImplement/Implements/SaleStorage.cs index d3d023c..da6dc95 100644 --- a/CarCenter/CarCenterDatabaseImplement/Implements/SaleStorage.cs +++ b/CarCenter/CarCenterDatabaseImplement/Implements/SaleStorage.cs @@ -17,7 +17,7 @@ namespace CarCenterDatabaseImplement.Implements public List GetFullList() { using var context = new CarCenterDatabase(); - return context.Sales.Include(x => x.Car).Include(x => x.Receipt).Include(x => x.Configuration).Include(x => x.EmployeeId) + return context.Sales.Include(x => x.Car).Include(x => x.EmployeeId) .Select(x => x.GetViewModel) .ToList(); } @@ -30,7 +30,7 @@ namespace CarCenterDatabaseImplement.Implements if (model.DateFrom.HasValue && model.DateTo.HasValue) { using var context = new CarCenterDatabase(); - return context.Sales.Include(x => x.Car).Include(x => x.Receipt).Include(x => x.Configuration).Include(x => x.EmployeeId) + return context.Sales.Include(x => x.Car).Include(x => x.EmployeeId) .Where(x => x.SaleDateTime >= model.DateFrom && x.SaleDateTime <= model.DateTo) .Select(x => x.GetViewModel) .ToList(); @@ -38,7 +38,7 @@ namespace CarCenterDatabaseImplement.Implements if (model.EmployeeId.HasValue) { using var context = new CarCenterDatabase(); - return context.Sales.Include(x => x.Car).Include(x => x.Receipt).Include(x => x.Configuration).Include(x => x.EmployeeId) + return context.Sales.Include(x => x.Car).Include(x => x.Employee) .Where(x => x.EmployeeId == model.EmployeeId) .Select(x => x.GetViewModel) .ToList(); @@ -46,7 +46,7 @@ namespace CarCenterDatabaseImplement.Implements else { using var context = new CarCenterDatabase(); - return context.Sales.Include(x => x.Car).Include(x => x.Receipt).Include(x => x.Configuration).Include(x => x.EmployeeId) + return context.Sales.Include(x => x.Car).Include(x => x.EmployeeId) .Where(x => x.Id == model.Id) .Select(x => x.GetViewModel) .ToList(); @@ -59,7 +59,7 @@ namespace CarCenterDatabaseImplement.Implements return null; } using var context = new CarCenterDatabase(); - return context.Sales.Include(x => x.Car).Include(x => x.Receipt).Include(x => x.Configuration).Include(x => x.EmployeeId) + return context.Sales.Include(x => x.Car).Include(x => x.EmployeeId) .FirstOrDefault(x => x.Id == model.Id) ?.GetViewModel; } diff --git a/CarCenter/CarCenterDatabaseImplement/Migrations/20230520041254_Presale.Designer.cs b/CarCenter/CarCenterDatabaseImplement/Migrations/20230520041254_Presale.Designer.cs new file mode 100644 index 0000000..476fa72 --- /dev/null +++ b/CarCenter/CarCenterDatabaseImplement/Migrations/20230520041254_Presale.Designer.cs @@ -0,0 +1,505 @@ +// +using System; +using CarCenterDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CarCenterDatabaseImplement.Migrations +{ + [DbContext(typeof(CarCenterDatabase))] + [Migration("20230520041254_Presale")] + partial class Presale + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Boss", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Login") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Patronymic") + .HasColumnType("nvarchar(max)"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Bosses"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Car", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.ToTable("Cars"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Configuration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BossId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BossId"); + + b.ToTable("Configurations"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.ConfigurationCar", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("ConfigurationId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CarId"); + + b.HasIndex("ConfigurationId"); + + b.ToTable("ConfigurationCars"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Login") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Patronymic") + .HasColumnType("nvarchar(max)"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Presale", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PresaleDate") + .HasColumnType("datetime2"); + + b.Property("TypeOfJobId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TypeOfJobId"); + + b.ToTable("Presales"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.PresaleCar", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("PresaleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CarId"); + + b.HasIndex("PresaleId"); + + b.ToTable("PresaleCars"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Receipt", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BossId") + .HasColumnType("int"); + + b.Property("ConfigurationId") + .HasColumnType("int"); + + b.Property("ReceiptDate") + .HasColumnType("datetime2"); + + b.Property("Sum") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("BossId"); + + b.HasIndex("ConfigurationId"); + + b.ToTable("Receipts"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Sale", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("ConfigurationId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("ReceiptId") + .HasColumnType("int"); + + b.Property("SaleDateTime") + .HasColumnType("datetime2"); + + b.Property("Sum") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("CarId"); + + b.HasIndex("ConfigurationId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ReceiptId"); + + b.ToTable("Sales"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BossId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BossId"); + + b.ToTable("TypeOfJobs"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJobConfiguration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConfigurationId") + .HasColumnType("int"); + + b.Property("TypeOfJobId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ConfigurationId"); + + b.HasIndex("TypeOfJobId"); + + b.ToTable("TypeOfJobConfigurations"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Car", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Configuration", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Boss", "Boss") + .WithMany() + .HasForeignKey("BossId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Boss"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.ConfigurationCar", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Car", "Car") + .WithMany("Configurations") + .HasForeignKey("CarId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Configuration", "Configuration") + .WithMany() + .HasForeignKey("ConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Car"); + + b.Navigation("Configuration"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Presale", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.TypeOfJob", "TypeOfJob") + .WithMany() + .HasForeignKey("TypeOfJobId"); + + b.Navigation("Employee"); + + b.Navigation("TypeOfJob"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.PresaleCar", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Car", "Car") + .WithMany("Presales") + .HasForeignKey("CarId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Presale", "Presale") + .WithMany("PresaleCars") + .HasForeignKey("PresaleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Car"); + + b.Navigation("Presale"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Receipt", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Boss", "Boss") + .WithMany() + .HasForeignKey("BossId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Configuration", "Configuration") + .WithMany() + .HasForeignKey("ConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Boss"); + + b.Navigation("Configuration"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Sale", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Car", "Car") + .WithMany() + .HasForeignKey("CarId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Configuration", "Configuration") + .WithMany() + .HasForeignKey("ConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Receipt", "Receipt") + .WithMany() + .HasForeignKey("ReceiptId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Car"); + + b.Navigation("Configuration"); + + b.Navigation("Employee"); + + b.Navigation("Receipt"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJob", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Boss", "Boss") + .WithMany() + .HasForeignKey("BossId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Boss"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJobConfiguration", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Configuration", "Configuration") + .WithMany() + .HasForeignKey("ConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.TypeOfJob", "TypeOfJob") + .WithMany("Configurations") + .HasForeignKey("TypeOfJobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Configuration"); + + b.Navigation("TypeOfJob"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Car", b => + { + b.Navigation("Configurations"); + + b.Navigation("Presales"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Presale", b => + { + b.Navigation("PresaleCars"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJob", b => + { + b.Navigation("Configurations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CarCenter/CarCenterDatabaseImplement/Migrations/20230520041254_Presale.cs b/CarCenter/CarCenterDatabaseImplement/Migrations/20230520041254_Presale.cs new file mode 100644 index 0000000..5adccb4 --- /dev/null +++ b/CarCenter/CarCenterDatabaseImplement/Migrations/20230520041254_Presale.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CarCenterDatabaseImplement.Migrations +{ + /// + public partial class Presale : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Name", + table: "Presales", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Name", + table: "Presales"); + } + } +} diff --git a/CarCenter/CarCenterDatabaseImplement/Migrations/20230520043811_Sales.Designer.cs b/CarCenter/CarCenterDatabaseImplement/Migrations/20230520043811_Sales.Designer.cs new file mode 100644 index 0000000..9ad3997 --- /dev/null +++ b/CarCenter/CarCenterDatabaseImplement/Migrations/20230520043811_Sales.Designer.cs @@ -0,0 +1,479 @@ +// +using System; +using CarCenterDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CarCenterDatabaseImplement.Migrations +{ + [DbContext(typeof(CarCenterDatabase))] + [Migration("20230520043811_Sales")] + partial class Sales + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Boss", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Login") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Patronymic") + .HasColumnType("nvarchar(max)"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Bosses"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Car", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.ToTable("Cars"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Configuration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BossId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BossId"); + + b.ToTable("Configurations"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.ConfigurationCar", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("ConfigurationId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CarId"); + + b.HasIndex("ConfigurationId"); + + b.ToTable("ConfigurationCars"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Login") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Patronymic") + .HasColumnType("nvarchar(max)"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Presale", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PresaleDate") + .HasColumnType("datetime2"); + + b.Property("TypeOfJobId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TypeOfJobId"); + + b.ToTable("Presales"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.PresaleCar", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("PresaleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CarId"); + + b.HasIndex("PresaleId"); + + b.ToTable("PresaleCars"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Receipt", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BossId") + .HasColumnType("int"); + + b.Property("ConfigurationId") + .HasColumnType("int"); + + b.Property("ReceiptDate") + .HasColumnType("datetime2"); + + b.Property("Sum") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("BossId"); + + b.HasIndex("ConfigurationId"); + + b.ToTable("Receipts"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Sale", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CarId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("SaleDateTime") + .HasColumnType("datetime2"); + + b.Property("Sum") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("CarId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("Sales"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BossId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BossId"); + + b.ToTable("TypeOfJobs"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJobConfiguration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConfigurationId") + .HasColumnType("int"); + + b.Property("TypeOfJobId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ConfigurationId"); + + b.HasIndex("TypeOfJobId"); + + b.ToTable("TypeOfJobConfigurations"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Car", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Configuration", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Boss", "Boss") + .WithMany() + .HasForeignKey("BossId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Boss"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.ConfigurationCar", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Car", "Car") + .WithMany("Configurations") + .HasForeignKey("CarId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Configuration", "Configuration") + .WithMany() + .HasForeignKey("ConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Car"); + + b.Navigation("Configuration"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Presale", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.TypeOfJob", "TypeOfJob") + .WithMany() + .HasForeignKey("TypeOfJobId"); + + b.Navigation("Employee"); + + b.Navigation("TypeOfJob"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.PresaleCar", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Car", "Car") + .WithMany("Presales") + .HasForeignKey("CarId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Presale", "Presale") + .WithMany("PresaleCars") + .HasForeignKey("PresaleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Car"); + + b.Navigation("Presale"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Receipt", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Boss", "Boss") + .WithMany() + .HasForeignKey("BossId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Configuration", "Configuration") + .WithMany() + .HasForeignKey("ConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Boss"); + + b.Navigation("Configuration"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Sale", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Car", "Car") + .WithMany() + .HasForeignKey("CarId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Car"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJob", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Boss", "Boss") + .WithMany() + .HasForeignKey("BossId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Boss"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJobConfiguration", b => + { + b.HasOne("CarCenterDatabaseImplement.Models.Configuration", "Configuration") + .WithMany() + .HasForeignKey("ConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarCenterDatabaseImplement.Models.TypeOfJob", "TypeOfJob") + .WithMany("Configurations") + .HasForeignKey("TypeOfJobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Configuration"); + + b.Navigation("TypeOfJob"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Car", b => + { + b.Navigation("Configurations"); + + b.Navigation("Presales"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.Presale", b => + { + b.Navigation("PresaleCars"); + }); + + modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJob", b => + { + b.Navigation("Configurations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CarCenter/CarCenterDatabaseImplement/Migrations/20230520043811_Sales.cs b/CarCenter/CarCenterDatabaseImplement/Migrations/20230520043811_Sales.cs new file mode 100644 index 0000000..aff5627 --- /dev/null +++ b/CarCenter/CarCenterDatabaseImplement/Migrations/20230520043811_Sales.cs @@ -0,0 +1,82 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CarCenterDatabaseImplement.Migrations +{ + /// + public partial class Sales : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Sales_Configurations_ConfigurationId", + table: "Sales"); + + migrationBuilder.DropForeignKey( + name: "FK_Sales_Receipts_ReceiptId", + table: "Sales"); + + migrationBuilder.DropIndex( + name: "IX_Sales_ConfigurationId", + table: "Sales"); + + migrationBuilder.DropIndex( + name: "IX_Sales_ReceiptId", + table: "Sales"); + + migrationBuilder.DropColumn( + name: "ConfigurationId", + table: "Sales"); + + migrationBuilder.DropColumn( + name: "ReceiptId", + table: "Sales"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ConfigurationId", + table: "Sales", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "ReceiptId", + table: "Sales", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateIndex( + name: "IX_Sales_ConfigurationId", + table: "Sales", + column: "ConfigurationId"); + + migrationBuilder.CreateIndex( + name: "IX_Sales_ReceiptId", + table: "Sales", + column: "ReceiptId"); + + migrationBuilder.AddForeignKey( + name: "FK_Sales_Configurations_ConfigurationId", + table: "Sales", + column: "ConfigurationId", + principalTable: "Configurations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Sales_Receipts_ReceiptId", + table: "Sales", + column: "ReceiptId", + principalTable: "Receipts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/CarCenter/CarCenterDatabaseImplement/Migrations/CarCenterDatabaseModelSnapshot.cs b/CarCenter/CarCenterDatabaseImplement/Migrations/CarCenterDatabaseModelSnapshot.cs index 538c0b7..e580a06 100644 --- a/CarCenter/CarCenterDatabaseImplement/Migrations/CarCenterDatabaseModelSnapshot.cs +++ b/CarCenter/CarCenterDatabaseImplement/Migrations/CarCenterDatabaseModelSnapshot.cs @@ -17,7 +17,7 @@ namespace CarCenterDatabaseImplement.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.4") + .HasAnnotation("ProductVersion", "7.0.5") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -164,6 +164,10 @@ namespace CarCenterDatabaseImplement.Migrations b.Property("EmployeeId") .HasColumnType("int"); + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + b.Property("PresaleDate") .HasColumnType("datetime2"); @@ -242,15 +246,9 @@ namespace CarCenterDatabaseImplement.Migrations b.Property("CarId") .HasColumnType("int"); - b.Property("ConfigurationId") - .HasColumnType("int"); - b.Property("EmployeeId") .HasColumnType("int"); - b.Property("ReceiptId") - .HasColumnType("int"); - b.Property("SaleDateTime") .HasColumnType("datetime2"); @@ -261,12 +259,8 @@ namespace CarCenterDatabaseImplement.Migrations b.HasIndex("CarId"); - b.HasIndex("ConfigurationId"); - b.HasIndex("EmployeeId"); - b.HasIndex("ReceiptId"); - b.ToTable("Sales"); }); @@ -419,31 +413,15 @@ namespace CarCenterDatabaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("CarCenterDatabaseImplement.Models.Configuration", "Configuration") - .WithMany() - .HasForeignKey("ConfigurationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - b.HasOne("CarCenterDatabaseImplement.Models.Employee", "Employee") .WithMany() .HasForeignKey("EmployeeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("CarCenterDatabaseImplement.Models.Receipt", "Receipt") - .WithMany() - .HasForeignKey("ReceiptId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - b.Navigation("Car"); - b.Navigation("Configuration"); - b.Navigation("Employee"); - - b.Navigation("Receipt"); }); modelBuilder.Entity("CarCenterDatabaseImplement.Models.TypeOfJob", b => diff --git a/CarCenter/CarCenterDatabaseImplement/Models/Car.cs b/CarCenter/CarCenterDatabaseImplement/Models/Car.cs index c77544f..f966b4f 100644 --- a/CarCenter/CarCenterDatabaseImplement/Models/Car.cs +++ b/CarCenter/CarCenterDatabaseImplement/Models/Car.cs @@ -57,6 +57,7 @@ namespace CarCenterDatabaseImplement.Models return new Car() { Id = model.Id, + Name=model.Name, Configurations = model.ConfigurationCars.Select(x => new ConfigurationCar { Configuration = context.Configurations.First(y => y.Id == x.Key) @@ -71,7 +72,6 @@ namespace CarCenterDatabaseImplement.Models { return; } - Name = model.Name; } public CarViewModel GetViewModel => new() { diff --git a/CarCenter/CarCenterDatabaseImplement/Models/Presale.cs b/CarCenter/CarCenterDatabaseImplement/Models/Presale.cs index 281390d..f56218d 100644 --- a/CarCenter/CarCenterDatabaseImplement/Models/Presale.cs +++ b/CarCenter/CarCenterDatabaseImplement/Models/Presale.cs @@ -18,6 +18,7 @@ namespace CarCenterDatabaseImplement.Models public DateTime PresaleDate { get; set; } = DateTime.Now; [Required] public int EmployeeId { get; set; } + public String Name { get; set; } public virtual Employee Employee { get; set; } = new(); public int? TypeOfJobId {get; set; } public virtual TypeOfJob? TypeOfJob { get; set; } @@ -32,6 +33,7 @@ namespace CarCenterDatabaseImplement.Models return new Presale() { Id = model.Id, + Name = model.Name, PresaleDate = model.PresaleDate, EmployeeId = model.EmployeeId, Employee = context.Employees.First(x => x.Id == model.EmployeeId) @@ -44,11 +46,13 @@ namespace CarCenterDatabaseImplement.Models return; } if (model.TypeOfJobId.HasValue) TypeOfJobId = TypeOfJobId; + Name = Name; } public PresaleViewModel GetViewModel => new() { Id = Id, TypeOfJobId = TypeOfJobId, + Name=Name, PresaleDate = PresaleDate, EmployeeId = EmployeeId, EmployeeName = Employee.Surname + " " + Employee.Name + " " + Employee.Patronymic, diff --git a/CarCenter/CarCenterDatabaseImplement/Models/Sale.cs b/CarCenter/CarCenterDatabaseImplement/Models/Sale.cs index 9165ff7..c7ed07f 100644 --- a/CarCenter/CarCenterDatabaseImplement/Models/Sale.cs +++ b/CarCenter/CarCenterDatabaseImplement/Models/Sale.cs @@ -20,10 +20,6 @@ namespace CarCenterDatabaseImplement.Models [Required] public int CarId { get; set; } public virtual Car Car { get; set; } = new(); - public int ReceiptId { get; set; } - public virtual Receipt Receipt { get; set; } = new(); - public int ConfigurationId { get; set; } - public virtual Configuration Configuration { get; set; } = new(); public int EmployeeId { get; set; } public virtual Employee Employee { get; set; } = new(); public static Sale? Create(CarCenterDatabase context, SaleBindingModel model) @@ -39,10 +35,6 @@ namespace CarCenterDatabaseImplement.Models SaleDateTime = model.SaleDateTime, CarId = model.CarId, Car = context.Cars.First(x => x.Id == model.CarId), - ReceiptId = model.ReceiptId, - Receipt = context.Receipts.First(x => x.Id == model.ReceiptId), - ConfigurationId = model.ConfigurationId, - Configuration = context.Configurations.First(x => x.Id == model.ConfigurationId), EmployeeId = model.EmployeeId, Employee = context.Employees.First(x => x.Id == model.EmployeeId) }; @@ -56,10 +48,6 @@ namespace CarCenterDatabaseImplement.Models SaleDateTime = model.SaleDateTime, CarId = model.CarId, Car = context.Cars.First(x => x.Id == model.CarId), - ReceiptId = model.ReceiptId, - Receipt = context.Receipts.First(x => x.Id == model.ReceiptId), - ConfigurationId = model.ConfigurationId, - Configuration = context.Configurations.First(x => x.Id == model.ConfigurationId) }; } public void Update(SaleBindingModel? model) diff --git a/CarCenter/EmployeeApp/Controllers/HomeController.cs b/CarCenter/EmployeeApp/Controllers/HomeController.cs index 323c224..47af51e 100644 --- a/CarCenter/EmployeeApp/Controllers/HomeController.cs +++ b/CarCenter/EmployeeApp/Controllers/HomeController.cs @@ -25,7 +25,7 @@ namespace EmployeeApp.Controllers _employeeLogic = employeeLogic; } - public IActionResult Index() + public IActionResult Index(String name) { if (APIClient.Employee == null) { @@ -131,7 +131,7 @@ namespace EmployeeApp.Controllers } [HttpPost] - public void CreatePresale(int carid) + public void CreatePresale(String name) { if (APIClient.Employee == null) { @@ -140,6 +140,7 @@ namespace EmployeeApp.Controllers _presaleLogic.Create(new PresaleBindingModel { EmployeeId = APIClient.Employee.Id, + Name = name }); Response.Redirect("Index"); } @@ -158,7 +159,7 @@ namespace EmployeeApp.Controllers return View(); } [HttpPost] - public void CreateCar(List presales) + public void CreateCar(List presales, String name) { if (APIClient.Employee == null) { @@ -170,7 +171,7 @@ namespace EmployeeApp.Controllers var presale = _presaleLogic.ReadElement(new PresaleSearchModel { Id = id }); if (presale != null) PresaleCars.Add(presale.Id, presale); } - _carLogic.Create(new CarBindingModel { EmployeeId = APIClient.Employee.Id, PresaleCars = PresaleCars, }); + _carLogic.Create(new CarBindingModel { EmployeeId = APIClient.Employee.Id, Name=name, PresaleCars = PresaleCars }); Response.Redirect("Cars"); } [HttpGet] @@ -194,19 +195,19 @@ namespace EmployeeApp.Controllers { throw new Exception("Вы как суда попали? Суда вход только авторизованным"); } - ViewBag.Cars = _carLogic.ReadList(new CarSearchModel { EmployeeId = APIClient.Employee.Id }); + ViewBag.Cars = _carLogic.ReadList(new CarSearchModel { EmployeeId = APIClient.Employee.Id}); return View(); } [HttpPost] - public void CreateSale(string sum, int carid) + public void CreateSale(string sum, int car) { if (APIClient.Employee == null) { throw new Exception("Вы как суда попали? Суда вход только авторизованным"); } - _saleLogic.Create(new SaleBindingModel { EmployeeId = APIClient.Employee.Id, Sum = (float)Convert.ToDouble(sum), CarId = carid }); - Response.Redirect("Transfers"); + _saleLogic.Create(new SaleBindingModel { EmployeeId = APIClient.Employee.Id, Sum = (float)Convert.ToDouble(sum), CarId=car }); + Response.Redirect("Sales"); } } } \ No newline at end of file diff --git a/CarCenter/EmployeeApp/Views/Home/Car.cshtml b/CarCenter/EmployeeApp/Views/Home/Car.cshtml index e1dd794..2610bac 100644 --- a/CarCenter/EmployeeApp/Views/Home/Car.cshtml +++ b/CarCenter/EmployeeApp/Views/Home/Car.cshtml @@ -1,5 +1,28 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ +@using CarCenterContracts.ViewModels + +@model CarViewModel + @{ + ViewData["Title"] = "Car"; } + +
+

Машина №@Model.Id

+
+ + +
+ @{ + if (Model == null) + { +

Авторизируйтесь

+ return; + } + } +

Название @Model.Name

+

Работник: @Model.EmployeeName

+

Предпродажные работы:

+ @foreach (var presale in Model.PresaleCars){ +
Предпродажная работа №@presale.Value.Id, от @presale.Value.PresaleDate
+ } +
diff --git a/CarCenter/EmployeeApp/Views/Home/Cars.cshtml b/CarCenter/EmployeeApp/Views/Home/Cars.cshtml index e1dd794..487850c 100644 --- a/CarCenter/EmployeeApp/Views/Home/Cars.cshtml +++ b/CarCenter/EmployeeApp/Views/Home/Cars.cshtml @@ -1,5 +1,62 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ +@using CarCenterContracts.ViewModels + +@model List + @{ + ViewData["Title"] = "Cars"; } + +
+

Машины

+
+ + +
+ @{ + if (Model == null) + { +

Авторизируйтесь

+ return; + } + +

+ Создать машину +

+ + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + } + +
+ Номер машины + + Название машины + + ФИО работника + +
+ @Html.DisplayFor(modelItem => item.Id) + + @Html.DisplayFor(modelItem => item.Name) + + @Html.DisplayFor(modelItem => item.EmployeeName) + + Посмотреть +
+ } +
\ No newline at end of file diff --git a/CarCenter/EmployeeApp/Views/Home/CreateCar.cshtml b/CarCenter/EmployeeApp/Views/Home/CreateCar.cshtml index 2fd6ac9..694187c 100644 --- a/CarCenter/EmployeeApp/Views/Home/CreateCar.cshtml +++ b/CarCenter/EmployeeApp/Views/Home/CreateCar.cshtml @@ -6,9 +6,11 @@
+
Название машины:
+
Предпродажные работы:
- +
diff --git a/CarCenter/EmployeeApp/Views/Home/CreatePresale.cshtml b/CarCenter/EmployeeApp/Views/Home/CreatePresale.cshtml index 139081d..1d6d0b3 100644 --- a/CarCenter/EmployeeApp/Views/Home/CreatePresale.cshtml +++ b/CarCenter/EmployeeApp/Views/Home/CreatePresale.cshtml @@ -1,13 +1,13 @@ @{ - ViewData["Title"] = "CreateDeal"; + ViewData["Title"] = "CreatePresale"; }
-

Создание сделки

+

Создание предпродажной работы

-
ID машины:
-
+
Название:
+
diff --git a/CarCenter/EmployeeApp/Views/Home/Index.cshtml b/CarCenter/EmployeeApp/Views/Home/Index.cshtml index 8b90d3f..13412c3 100644 --- a/CarCenter/EmployeeApp/Views/Home/Index.cshtml +++ b/CarCenter/EmployeeApp/Views/Home/Index.cshtml @@ -20,7 +20,7 @@ }

- Создать предпродажную работу + Создать предпродажную работу

@@ -29,10 +29,10 @@ Номер предпродажной работы
- ФИО работника + Название - Вид работы + ФИО работника Дата @@ -47,10 +47,10 @@ @Html.DisplayFor(modelItem => item.Id) - @Html.DisplayFor(modelItem => item.EmployeeName) + @Html.DisplayFor(modelItem => item.Name) - @Html.DisplayFor(modelItem => item.TypeOfJobName) + @Html.DisplayFor(modelItem => item.EmployeeName) @Html.DisplayFor(modelItem => item.PresaleDate) diff --git a/CarCenter/EmployeeApp/Views/Home/Sales.cshtml b/CarCenter/EmployeeApp/Views/Home/Sales.cshtml index 6d372cd..6467a8f 100644 --- a/CarCenter/EmployeeApp/Views/Home/Sales.cshtml +++ b/CarCenter/EmployeeApp/Views/Home/Sales.cshtml @@ -20,7 +20,7 @@ }

- Создать продажу + Создать продажу