Правки ремонта
This commit is contained in:
parent
45d0720932
commit
221410e1f3
@ -14,7 +14,7 @@ namespace ServiceStationContracts.BindingModels
|
||||
|
||||
public string RepairName { get; set; } = string.Empty;
|
||||
|
||||
public RepairStatus Status { get; set; } = RepairStatus.Неизвестен;
|
||||
public DateTime? RepairStartDate { get; set; } = DateTime.Now;
|
||||
|
||||
public double RepairPrice { get; set; }
|
||||
|
||||
|
@ -12,5 +12,7 @@ namespace ServiceStationContracts.SearchModels
|
||||
public string? RepairName { get; set; }
|
||||
public int? GuarantorId { get; set; }
|
||||
public int? DefectId { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ namespace ServiceStationContracts.ViewModels
|
||||
[DisplayName("Наименование ремонта")]
|
||||
public string RepairName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Статус ремонта")]
|
||||
public RepairStatus Status { get; set; }
|
||||
[DisplayName("Начало ремонта")]
|
||||
public DateTime? RepairStartDate { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Стоимость ремонта")]
|
||||
public double RepairPrice { get; set; }
|
||||
|
@ -10,7 +10,7 @@ namespace ServiceStationDataModels.Models
|
||||
{
|
||||
string RepairName { get; }
|
||||
|
||||
Enums.RepairStatus Status { get; }
|
||||
DateTime? RepairStartDate { get; }
|
||||
|
||||
double RepairPrice { get; }
|
||||
|
||||
|
@ -29,9 +29,23 @@ namespace ServiceStationDatabaseImplement.Implements
|
||||
|
||||
public List<RepairViewModel> GetFilteredList(RepairSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.RepairName) && !model.GuarantorId.HasValue) return new();
|
||||
if (string.IsNullOrEmpty(model.RepairName) && !model.GuarantorId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue) return new();
|
||||
using var context = new ServiceStationDatabase();
|
||||
|
||||
if(model.DateTo.HasValue && model.DateTo.HasValue && model.GuarantorId.HasValue)
|
||||
{
|
||||
return context.Repairs
|
||||
.Include(x => x.SpareParts)
|
||||
.ThenInclude(x => x.SparePart)
|
||||
.ThenInclude(x => x.SparePartWorks)
|
||||
.ThenInclude(x => x.Work)
|
||||
.Include(x => x.Guarantor)
|
||||
.Where(x => x.RepairStartDate >= model.DateFrom && x.RepairStartDate <= model.DateTo && x.GuarantorId == model.GuarantorId)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (model.GuarantorId.HasValue)
|
||||
{
|
||||
return context.Repairs
|
||||
|
558
ServiceStation/ServiceStationDatabaseImplement/Migrations/20240430202710_CorrectionMigration.Designer.cs
generated
Normal file
558
ServiceStation/ServiceStationDatabaseImplement/Migrations/20240430202710_CorrectionMigration.Designer.cs
generated
Normal file
@ -0,0 +1,558 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ServiceStationDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ServiceStationDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ServiceStationDatabase))]
|
||||
[Migration("20240430202710_CorrectionMigration")]
|
||||
partial class CorrectionMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.18")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Car", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CarBrand")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("CarNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Cars");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.CarDefect", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CarId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DefectId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CarId");
|
||||
|
||||
b.HasIndex("DefectId");
|
||||
|
||||
b.ToTable("CarDefects");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.CarTechnicalWork", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CarId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TechnicalWorkId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CarId");
|
||||
|
||||
b.HasIndex("TechnicalWorkId");
|
||||
|
||||
b.ToTable("CarTechnicalWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Defect", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("DefectPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("DefectType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("RepairId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.HasIndex("RepairId");
|
||||
|
||||
b.ToTable("Defects");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Executor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ExecutorEmail")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ExecutorFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ExecutorNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ExecutorPassword")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Executors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Guarantor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("GuarantorEmail")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GuarantorFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GuarantorNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GuarantorPassword")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Guarantors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Repair", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RepairName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("RepairPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime?>("RepairStartDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Repairs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.SparePart", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SparePartName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("SparePartPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("SpareParts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.SparePartRepair", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("RepairId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SparePartId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RepairId");
|
||||
|
||||
b.HasIndex("SparePartId");
|
||||
|
||||
b.ToTable("SparePartRepairs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.SparePartWork", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("SparePartId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("WorkId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SparePartId");
|
||||
|
||||
b.HasIndex("WorkId");
|
||||
|
||||
b.ToTable("SparePartWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.TechnicalWork", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("DateStartWork")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("WorkPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("WorkType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("TechnicalWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Work", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("TechnicalWorkId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WorkName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("WorkPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.HasIndex("TechnicalWorkId");
|
||||
|
||||
b.ToTable("Works");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Car", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Executor", "Executor")
|
||||
.WithMany("Cars")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Executor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.CarDefect", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Car", "Car")
|
||||
.WithMany("CarDefects")
|
||||
.HasForeignKey("CarId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Defect", "Defect")
|
||||
.WithMany("Cars")
|
||||
.HasForeignKey("DefectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Car");
|
||||
|
||||
b.Navigation("Defect");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.CarTechnicalWork", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Car", "Car")
|
||||
.WithMany("CarTechnicalWorks")
|
||||
.HasForeignKey("CarId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.TechnicalWork", "TechnicalWork")
|
||||
.WithMany("Cars")
|
||||
.HasForeignKey("TechnicalWorkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Car");
|
||||
|
||||
b.Navigation("TechnicalWork");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Defect", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Executor", "Executor")
|
||||
.WithMany("Defects")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Repair", "Repair")
|
||||
.WithMany("Defects")
|
||||
.HasForeignKey("RepairId");
|
||||
|
||||
b.Navigation("Executor");
|
||||
|
||||
b.Navigation("Repair");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Repair", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Guarantor", "Guarantor")
|
||||
.WithMany("Repairs")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Guarantor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.SparePart", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Guarantor", "Guarantor")
|
||||
.WithMany("SpareParts")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Guarantor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.SparePartRepair", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Repair", "Repair")
|
||||
.WithMany("SpareParts")
|
||||
.HasForeignKey("RepairId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.SparePart", "SparePart")
|
||||
.WithMany("SparePartRepairs")
|
||||
.HasForeignKey("SparePartId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Repair");
|
||||
|
||||
b.Navigation("SparePart");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.SparePartWork", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.SparePart", "SparePart")
|
||||
.WithMany("SparePartWorks")
|
||||
.HasForeignKey("SparePartId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Work", "Work")
|
||||
.WithMany("SpareParts")
|
||||
.HasForeignKey("WorkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("SparePart");
|
||||
|
||||
b.Navigation("Work");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.TechnicalWork", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Executor", "Executor")
|
||||
.WithMany("TechnicalWorks")
|
||||
.HasForeignKey("ExecutorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Executor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Work", b =>
|
||||
{
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.Guarantor", "Guarantor")
|
||||
.WithMany("Works")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ServiceStationDatabaseImplement.Models.TechnicalWork", "TechnicalWork")
|
||||
.WithMany("Works")
|
||||
.HasForeignKey("TechnicalWorkId");
|
||||
|
||||
b.Navigation("Guarantor");
|
||||
|
||||
b.Navigation("TechnicalWork");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Car", b =>
|
||||
{
|
||||
b.Navigation("CarDefects");
|
||||
|
||||
b.Navigation("CarTechnicalWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Defect", b =>
|
||||
{
|
||||
b.Navigation("Cars");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Executor", b =>
|
||||
{
|
||||
b.Navigation("Cars");
|
||||
|
||||
b.Navigation("Defects");
|
||||
|
||||
b.Navigation("TechnicalWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Guarantor", b =>
|
||||
{
|
||||
b.Navigation("Repairs");
|
||||
|
||||
b.Navigation("SpareParts");
|
||||
|
||||
b.Navigation("Works");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Repair", b =>
|
||||
{
|
||||
b.Navigation("Defects");
|
||||
|
||||
b.Navigation("SpareParts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.SparePart", b =>
|
||||
{
|
||||
b.Navigation("SparePartRepairs");
|
||||
|
||||
b.Navigation("SparePartWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.TechnicalWork", b =>
|
||||
{
|
||||
b.Navigation("Cars");
|
||||
|
||||
b.Navigation("Works");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ServiceStationDatabaseImplement.Models.Work", b =>
|
||||
{
|
||||
b.Navigation("SpareParts");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ServiceStationDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CorrectionMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Status",
|
||||
table: "Repairs");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "RepairStartDate",
|
||||
table: "Repairs",
|
||||
type: "datetime2",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RepairStartDate",
|
||||
table: "Repairs");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Status",
|
||||
table: "Repairs",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
}
|
||||
}
|
@ -198,8 +198,8 @@ namespace ServiceStationDatabaseImplement.Migrations
|
||||
b.Property<double>("RepairPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
b.Property<DateTime?>("RepairStartDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
|
@ -19,8 +19,7 @@ namespace ServiceStationDatabaseImplement.Models
|
||||
[Required]
|
||||
public string RepairName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public RepairStatus Status { get; set; }
|
||||
public DateTime? RepairStartDate { get; set; } = DateTime.Now;
|
||||
|
||||
[Required]
|
||||
public double RepairPrice { get; set; }
|
||||
@ -58,7 +57,7 @@ namespace ServiceStationDatabaseImplement.Models
|
||||
{
|
||||
Id = model.Id,
|
||||
RepairName = model.RepairName,
|
||||
Status = model.Status,
|
||||
RepairStartDate = model.RepairStartDate,
|
||||
RepairPrice = model.RepairPrice,
|
||||
GuarantorId = model.GuarantorId,
|
||||
SpareParts = model.RepairSpareParts.Select(x => new SparePartRepair
|
||||
@ -72,7 +71,7 @@ namespace ServiceStationDatabaseImplement.Models
|
||||
{
|
||||
if (model == null) return;
|
||||
RepairName = model.RepairName;
|
||||
Status = model.Status;
|
||||
RepairStartDate = model.RepairStartDate;
|
||||
RepairPrice = model.RepairPrice;
|
||||
}
|
||||
|
||||
@ -80,7 +79,7 @@ namespace ServiceStationDatabaseImplement.Models
|
||||
{
|
||||
Id = Id,
|
||||
RepairName = RepairName,
|
||||
Status = Status,
|
||||
RepairStartDate = RepairStartDate,
|
||||
RepairPrice = RepairPrice,
|
||||
GuarantorId = GuarantorId,
|
||||
RepairSpareParts = RepairSpareParts
|
||||
|
Loading…
Reference in New Issue
Block a user