diff --git a/FlowerShopBusinessLogic/MessageInfoLogic.cs b/FlowerShopBusinessLogic/MessageInfoLogic.cs index b8881ba..036be04 100644 --- a/FlowerShopBusinessLogic/MessageInfoLogic.cs +++ b/FlowerShopBusinessLogic/MessageInfoLogic.cs @@ -44,5 +44,28 @@ namespace FlowerShopBusinessLogic.BusinessLogic _logger.LogInformation("ReadList. Count:{Count}", list.Count); return list; } + public MessageInfoViewModel? ReadElement(MessageInfoSearchModel model) + { + _logger.LogInformation("ReadElement. MessageId:{MessageId}", model?.MessageId); + if (model == null) + throw new ArgumentNullException(nameof(model)); + var element = _messageInfoStorage.GetElement(model); + if (element == null) + { + _logger.LogWarning("ReadElement element not found"); + return null; + } + _logger.LogInformation("ReadElement find. Id:{Id}", element.MessageId); + return element; + } + public bool Update(MessageInfoBindingModel model) + { + if (_messageInfoStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } } } diff --git a/FlowerShopContracts/BindingModels/MailReplySendInfoBindingModel.cs b/FlowerShopContracts/BindingModels/MailReplySendInfoBindingModel.cs new file mode 100644 index 0000000..81e6ef6 --- /dev/null +++ b/FlowerShopContracts/BindingModels/MailReplySendInfoBindingModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlowerShopContracts.BindingModels +{ + public class MailReplySendInfoBindingModel : MailSendInfoBindingModel + { + public string ParentMessageId { get; set; } = string.Empty; + } +} diff --git a/FlowerShopContracts/BindingModels/MessageInfoBindingModel.cs b/FlowerShopContracts/BindingModels/MessageInfoBindingModel.cs index 8b5fd4b..a186386 100644 --- a/FlowerShopContracts/BindingModels/MessageInfoBindingModel.cs +++ b/FlowerShopContracts/BindingModels/MessageInfoBindingModel.cs @@ -15,5 +15,8 @@ namespace FlowerShopContracts.BindingModels public string Subject { get; set; } = string.Empty; public string Body { get; set; } = string.Empty; public DateTime DateDelivery { get; set; } + public bool IsReaded { get; set; } + public string? ReplyMessageId { get; set; } + public bool IsReply { get; set; } } } diff --git a/FlowerShopContracts/BusinessLogicsContracts/IMessageInfoLogic.cs b/FlowerShopContracts/BusinessLogicsContracts/IMessageInfoLogic.cs index 5ee3529..25770c0 100644 --- a/FlowerShopContracts/BusinessLogicsContracts/IMessageInfoLogic.cs +++ b/FlowerShopContracts/BusinessLogicsContracts/IMessageInfoLogic.cs @@ -13,6 +13,8 @@ namespace FlowerShopContracts.BusinessLogicsContracts public interface IMessageInfoLogic { List? ReadList(MessageInfoSearchModel? model); + MessageInfoViewModel? ReadElement(MessageInfoSearchModel model); bool Create(MessageInfoBindingModel model); + bool Update(MessageInfoBindingModel model); } } diff --git a/FlowerShopContracts/SearchModels/MessageInfoSearchModel.cs b/FlowerShopContracts/SearchModels/MessageInfoSearchModel.cs index 0cd3da0..5511b6c 100644 --- a/FlowerShopContracts/SearchModels/MessageInfoSearchModel.cs +++ b/FlowerShopContracts/SearchModels/MessageInfoSearchModel.cs @@ -10,5 +10,7 @@ namespace FlowerShopContracts.SearchModels { public int? ClientId { get; set; } public string? MessageId { get; set; } + public int? PageLength { get; set; } + public int? PageIndex { get; set; } } } diff --git a/FlowerShopContracts/StoragesContracts/IMessageInfoStorage.cs b/FlowerShopContracts/StoragesContracts/IMessageInfoStorage.cs index 24bb382..0ee04d2 100644 --- a/FlowerShopContracts/StoragesContracts/IMessageInfoStorage.cs +++ b/FlowerShopContracts/StoragesContracts/IMessageInfoStorage.cs @@ -16,5 +16,7 @@ namespace FlowerShopContracts.StoragesContracts List GetFilteredList(MessageInfoSearchModel model); MessageInfoViewModel? GetElement(MessageInfoSearchModel model); MessageInfoViewModel? Insert(MessageInfoBindingModel model); + MessageInfoViewModel? Update(MessageInfoBindingModel model); + } } diff --git a/FlowerShopContracts/ViewModels/MessageInfoViewModel.cs b/FlowerShopContracts/ViewModels/MessageInfoViewModel.cs index 3f5339b..e44727a 100644 --- a/FlowerShopContracts/ViewModels/MessageInfoViewModel.cs +++ b/FlowerShopContracts/ViewModels/MessageInfoViewModel.cs @@ -20,5 +20,10 @@ namespace FlowerShopContracts.ViewModels public string Subject { get; set; } = string.Empty; [DisplayName("Текст")] public string Body { get; set; } = string.Empty; + [DisplayName("Прочитано")] + public bool IsReaded { get; set; } + public string? ReplyMessageId { get; set; } + public IMessageInfoModel? Reply { get; set; } + public bool IsReply { get; set; } } } diff --git a/FlowerShopDataModels/IMessageInfoModel.cs b/FlowerShopDataModels/IMessageInfoModel.cs index b03660a..a1b4ddc 100644 --- a/FlowerShopDataModels/IMessageInfoModel.cs +++ b/FlowerShopDataModels/IMessageInfoModel.cs @@ -14,6 +14,9 @@ namespace FlowerShopDataModels.Models DateTime DateDelivery { get; } string Subject { get; } string Body { get; } + bool IsReaded { get; } + string? ReplyMessageId { get; } + bool IsReply { get; } } }