Добавлены два поля сообщения
This commit is contained in:
parent
5c58ac9317
commit
9f71199535
@ -24,8 +24,10 @@ namespace ConfectioneryFileImplement.Models
|
||||
public string Subject { get; private set; } = string.Empty;
|
||||
|
||||
public string Body { get; private set; } = string.Empty;
|
||||
public bool HasRead { get; private set; }
|
||||
public string? Reply { get; private set; }
|
||||
|
||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -34,6 +36,8 @@ namespace ConfectioneryFileImplement.Models
|
||||
return new()
|
||||
{
|
||||
Body = model.Body,
|
||||
Reply = model.Reply,
|
||||
HasRead = model.HasRead,
|
||||
Subject = model.Subject,
|
||||
ClientId = model.ClientId,
|
||||
MessageId = model.MessageId,
|
||||
@ -51,6 +55,8 @@ namespace ConfectioneryFileImplement.Models
|
||||
return new()
|
||||
{
|
||||
Body = element.Attribute("Body")!.Value,
|
||||
Reply = element.Attribute("Reply")!.Value,
|
||||
HasRead = Convert.ToBoolean(element.Attribute("HasRead")!.Value),
|
||||
Subject = element.Attribute("Subject")!.Value,
|
||||
ClientId = Convert.ToInt32(element.Attribute("ClientId")!.Value),
|
||||
MessageId = element.Attribute("MessageId")!.Value,
|
||||
@ -59,9 +65,21 @@ namespace ConfectioneryFileImplement.Models
|
||||
};
|
||||
}
|
||||
|
||||
public MessageInfoViewModel GetViewModel => new()
|
||||
public void Update(MessageInfoBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Reply = model.Reply;
|
||||
HasRead = model.HasRead;
|
||||
}
|
||||
|
||||
public MessageInfoViewModel GetViewModel => new()
|
||||
{
|
||||
Body = Body,
|
||||
Reply = Reply,
|
||||
HasRead = HasRead,
|
||||
Subject = Subject,
|
||||
ClientId = ClientId,
|
||||
MessageId = MessageId,
|
||||
@ -71,6 +89,8 @@ namespace ConfectioneryFileImplement.Models
|
||||
|
||||
public XElement GetXElement => new("MessageInfo",
|
||||
new XAttribute("Body", Body),
|
||||
new XAttribute("Reply", Reply),
|
||||
new XAttribute("HasRead", HasRead),
|
||||
new XAttribute("Subject", Subject),
|
||||
new XAttribute("ClientId", ClientId),
|
||||
new XAttribute("MessageId", MessageId),
|
||||
|
@ -23,17 +23,21 @@ namespace ConfectioneryListImplement.Models
|
||||
public string Subject { get; private set; } = string.Empty;
|
||||
|
||||
public string Body { get; private set; } = string.Empty;
|
||||
public bool HasRead { get; private set; }
|
||||
public string? Reply { get; private set; }
|
||||
|
||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new()
|
||||
{
|
||||
Body = model.Body,
|
||||
Subject = model.Subject,
|
||||
{
|
||||
Body = model.Body,
|
||||
Reply = model.Reply,
|
||||
HasRead = model.HasRead,
|
||||
Subject = model.Subject,
|
||||
ClientId = model.ClientId,
|
||||
MessageId = model.MessageId,
|
||||
SenderName = model.SenderName,
|
||||
@ -41,9 +45,21 @@ namespace ConfectioneryListImplement.Models
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(MessageInfoBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Reply = model.Reply;
|
||||
HasRead = model.HasRead;
|
||||
}
|
||||
|
||||
public MessageInfoViewModel GetViewModel => new()
|
||||
{
|
||||
Body = Body,
|
||||
Reply = Reply,
|
||||
HasRead = HasRead,
|
||||
Subject = Subject,
|
||||
ClientId = ClientId,
|
||||
MessageId = MessageId,
|
||||
|
@ -20,5 +20,8 @@ namespace ConfectioneryContracts.BindingModels
|
||||
public string Body { get; set; } = string.Empty;
|
||||
|
||||
public DateTime DateDelivery { get; set; }
|
||||
}
|
||||
|
||||
public bool HasRead { get; set; }
|
||||
public string? Reply { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -25,5 +25,8 @@ namespace ConfectioneryContracts.ViewModels
|
||||
|
||||
[DisplayName("Текст")]
|
||||
public string Body { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public bool HasRead { get; set; }
|
||||
public string? Reply { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -19,5 +19,9 @@ namespace ConfectioneryDataModels
|
||||
string Subject { get; }
|
||||
|
||||
string Body { get; }
|
||||
}
|
||||
|
||||
public bool HasRead { get; }
|
||||
|
||||
public string? Reply { get; }
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,10 @@ namespace ConfectioneryDatabaseImplement.Models
|
||||
|
||||
public Client? Client { get; private set; }
|
||||
|
||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||
public bool HasRead { get; private set; }
|
||||
public string? Reply { get; private set; }
|
||||
|
||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -32,7 +35,9 @@ namespace ConfectioneryDatabaseImplement.Models
|
||||
return new()
|
||||
{
|
||||
Body = model.Body,
|
||||
Subject = model.Subject,
|
||||
Reply = model.Reply,
|
||||
HasRead = model.HasRead,
|
||||
Subject = model.Subject,
|
||||
ClientId = model.ClientId,
|
||||
MessageId = model.MessageId,
|
||||
SenderName = model.SenderName,
|
||||
@ -40,10 +45,22 @@ namespace ConfectioneryDatabaseImplement.Models
|
||||
};
|
||||
}
|
||||
|
||||
public MessageInfoViewModel GetViewModel => new()
|
||||
public void Update(MessageInfoBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Reply = model.Reply;
|
||||
HasRead = model.HasRead;
|
||||
}
|
||||
|
||||
public MessageInfoViewModel GetViewModel => new()
|
||||
{
|
||||
Body = Body,
|
||||
Subject = Subject,
|
||||
Reply = Reply,
|
||||
HasRead = HasRead,
|
||||
Subject = Subject,
|
||||
ClientId = ClientId,
|
||||
MessageId = MessageId,
|
||||
SenderName = SenderName,
|
||||
|
Loading…
Reference in New Issue
Block a user