small fix with relation between entities
This commit is contained in:
parent
b06e5065f6
commit
e7d0077ce4
@ -82,7 +82,7 @@ namespace ComputersShopBusinessLogic.BusinessLogics
|
|||||||
});
|
});
|
||||||
if (element == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Не удалоссь найти клиента, отправившего письмо с адреса Email:{Email}", model.SenderName);
|
_logger.LogWarning("Не удалось найти клиента, отправившего письмо с адреса Email:{Email}", model.SenderName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace ComputersShopDataBaseImplement.Migrations
|
namespace ComputersShopDataBaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ComputersShopDataBase))]
|
[DbContext(typeof(ComputersShopDataBase))]
|
||||||
[Migration("20240418105123_Init-Create")]
|
[Migration("20240430002234_InitialCreate")]
|
||||||
partial class InitCreate
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -237,9 +237,11 @@ namespace ComputersShopDataBaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Message", b =>
|
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Message", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ComputersShopDataBaseImplement.Models.Client", null)
|
b.HasOne("ComputersShopDataBaseImplement.Models.Client", "Client")
|
||||||
.WithMany("Messages")
|
.WithMany("Messages")
|
||||||
.HasForeignKey("ClientId");
|
.HasForeignKey("ClientId");
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Order", b =>
|
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Order", b =>
|
@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace ComputersShopDataBaseImplement.Migrations
|
namespace ComputersShopDataBaseImplement.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InitCreate : Migration
|
public partial class InitialCreate : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
@ -234,9 +234,11 @@ namespace ComputersShopDataBaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Message", b =>
|
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Message", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ComputersShopDataBaseImplement.Models.Client", null)
|
b.HasOne("ComputersShopDataBaseImplement.Models.Client", "Client")
|
||||||
.WithMany("Messages")
|
.WithMany("Messages")
|
||||||
.HasForeignKey("ClientId");
|
.HasForeignKey("ClientId");
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Order", b =>
|
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Order", b =>
|
||||||
|
@ -17,6 +17,8 @@ namespace ComputersShopDataBaseImplement.Models
|
|||||||
|
|
||||||
public int? ClientId { get; private set; }
|
public int? ClientId { get; private set; }
|
||||||
|
|
||||||
|
public virtual Client? Client { get; set; }
|
||||||
|
|
||||||
public string SenderName { get; private set; } = string.Empty;
|
public string SenderName { get; private set; } = string.Empty;
|
||||||
|
|
||||||
public DateTime DateDelivery { get; private set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
public DateTime DateDelivery { get; private set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||||
|
@ -47,7 +47,7 @@ namespace ComputersShopFileImplement
|
|||||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||||
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
||||||
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
|
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
|
||||||
Messages = LoadData(MessageFileName, "Message", x => Message.Create(x));
|
Messages = LoadData(MessageFileName, "Message", x => Message.Create(x)!)!;
|
||||||
}
|
}
|
||||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user