This commit is contained in:
antoc0der 2024-05-21 19:37:08 +04:00
parent f6614efa53
commit 417b42d187
8 changed files with 53 additions and 0 deletions

View File

@ -44,5 +44,28 @@ namespace FlowerShopBusinessLogic.BusinessLogic
_logger.LogInformation("ReadList. Count:{Count}", list.Count); _logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list; 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;
}
} }
} }

View File

@ -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;
}
}

View File

@ -15,5 +15,8 @@ namespace FlowerShopContracts.BindingModels
public string Subject { get; set; } = string.Empty; public string Subject { get; set; } = string.Empty;
public string Body { get; set; } = string.Empty; public string Body { get; set; } = string.Empty;
public DateTime DateDelivery { get; set; } public DateTime DateDelivery { get; set; }
public bool IsReaded { get; set; }
public string? ReplyMessageId { get; set; }
public bool IsReply { get; set; }
} }
} }

View File

@ -13,6 +13,8 @@ namespace FlowerShopContracts.BusinessLogicsContracts
public interface IMessageInfoLogic public interface IMessageInfoLogic
{ {
List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model); List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model);
MessageInfoViewModel? ReadElement(MessageInfoSearchModel model);
bool Create(MessageInfoBindingModel model); bool Create(MessageInfoBindingModel model);
bool Update(MessageInfoBindingModel model);
} }
} }

View File

@ -10,5 +10,7 @@ namespace FlowerShopContracts.SearchModels
{ {
public int? ClientId { get; set; } public int? ClientId { get; set; }
public string? MessageId { get; set; } public string? MessageId { get; set; }
public int? PageLength { get; set; }
public int? PageIndex { get; set; }
} }
} }

View File

@ -16,5 +16,7 @@ namespace FlowerShopContracts.StoragesContracts
List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model); List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model);
MessageInfoViewModel? GetElement(MessageInfoSearchModel model); MessageInfoViewModel? GetElement(MessageInfoSearchModel model);
MessageInfoViewModel? Insert(MessageInfoBindingModel model); MessageInfoViewModel? Insert(MessageInfoBindingModel model);
MessageInfoViewModel? Update(MessageInfoBindingModel model);
} }
} }

View File

@ -20,5 +20,10 @@ namespace FlowerShopContracts.ViewModels
public string Subject { get; set; } = string.Empty; public string Subject { get; set; } = string.Empty;
[DisplayName("Текст")] [DisplayName("Текст")]
public string Body { get; set; } = string.Empty; 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; }
} }
} }

View File

@ -14,6 +14,9 @@ namespace FlowerShopDataModels.Models
DateTime DateDelivery { get; } DateTime DateDelivery { get; }
string Subject { get; } string Subject { get; }
string Body { get; } string Body { get; }
bool IsReaded { get; }
string? ReplyMessageId { get; }
bool IsReply { get; }
} }
} }