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)
|
||||
{
|
||||
_logger.LogWarning("Не удалоссь найти клиента, отправившего письмо с адреса Email:{Email}", model.SenderName);
|
||||
_logger.LogWarning("Не удалось найти клиента, отправившего письмо с адреса Email:{Email}", model.SenderName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace ComputersShopDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ComputersShopDataBase))]
|
||||
[Migration("20240418105123_Init-Create")]
|
||||
partial class InitCreate
|
||||
[Migration("20240430002234_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -237,9 +237,11 @@ namespace ComputersShopDataBaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Message", b =>
|
||||
{
|
||||
b.HasOne("ComputersShopDataBaseImplement.Models.Client", null)
|
||||
b.HasOne("ComputersShopDataBaseImplement.Models.Client", "Client")
|
||||
.WithMany("Messages")
|
||||
.HasForeignKey("ClientId");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Order", b =>
|
@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace ComputersShopDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitCreate : Migration
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
@ -234,9 +234,11 @@ namespace ComputersShopDataBaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Message", b =>
|
||||
{
|
||||
b.HasOne("ComputersShopDataBaseImplement.Models.Client", null)
|
||||
b.HasOne("ComputersShopDataBaseImplement.Models.Client", "Client")
|
||||
.WithMany("Messages")
|
||||
.HasForeignKey("ClientId");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputersShopDataBaseImplement.Models.Order", b =>
|
||||
|
@ -17,6 +17,8 @@ namespace ComputersShopDataBaseImplement.Models
|
||||
|
||||
public int? ClientId { get; private set; }
|
||||
|
||||
public virtual Client? Client { get; set; }
|
||||
|
||||
public string SenderName { get; private set; } = string.Empty;
|
||||
|
||||
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)!)!;
|
||||
Clients = LoadData(ClientFileName, "Client", x => Client.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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user