diff --git a/ComputersShop/ComputersShopDatabaseImplement/Models/MessageInfo.cs b/ComputersShop/ComputersShopDatabaseImplement/Models/MessageInfo.cs index b3d5341..d6bbf9f 100644 --- a/ComputersShop/ComputersShopDatabaseImplement/Models/MessageInfo.cs +++ b/ComputersShop/ComputersShopDatabaseImplement/Models/MessageInfo.cs @@ -44,7 +44,7 @@ namespace ComputersShopDatabaseImplement.Models { Body = model.Body, Subject = model.Subject, - ClientId = context.Clients.FirstOrDefault(x => x.Email == model.SenderName).Id, + ClientId = context.Clients.FirstOrDefault(x => x.Email == model.SenderName)?.Id, Client = context.Clients.FirstOrDefault(x => x.Email == model.SenderName), MessageId = model.MessageId, SenderName = model.SenderName,