From d075650fc48ad8ecfe1d2f7de9d94af5e2578aa2 Mon Sep 17 00:00:00 2001 From: Viltskaa Date: Fri, 21 Apr 2023 18:57:07 +0400 Subject: [PATCH] Add configs and MessageInfo --- SushiBar/SushiBar/App.config | 11 +++++++++++ .../BindingModels/MessageInfoBindingModel.cs | 14 ++++++++++++++ .../IMessageInfoLogic.cs | 14 ++++++++++++++ .../SearchModels/MessageInfoSearchModel.cs | 7 +++++++ .../StoragesContracts/IMessageInfoStorage.cs | 15 +++++++++++++++ .../ViewModels/MessageInfoViewModel.cs | 17 +++++++++++++++++ .../SushiBarModels/Models/IMessageInfoModel.cs | 11 +++++++++++ .../Controllers/ImplementerController.cs | 2 +- SushiBar/SushiBarRestApi/appsettings.json | 8 +++++++- 9 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 SushiBar/SushiBar/App.config create mode 100644 SushiBar/SushiBarContracts/BindingModels/MessageInfoBindingModel.cs create mode 100644 SushiBar/SushiBarContracts/BusinessLogicsContracts/IMessageInfoLogic.cs create mode 100644 SushiBar/SushiBarContracts/SearchModels/MessageInfoSearchModel.cs create mode 100644 SushiBar/SushiBarContracts/StoragesContracts/IMessageInfoStorage.cs create mode 100644 SushiBar/SushiBarContracts/ViewModels/MessageInfoViewModel.cs create mode 100644 SushiBar/SushiBarModels/Models/IMessageInfoModel.cs diff --git a/SushiBar/SushiBar/App.config b/SushiBar/SushiBar/App.config new file mode 100644 index 0000000..18a0b0f --- /dev/null +++ b/SushiBar/SushiBar/App.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/SushiBar/SushiBarContracts/BindingModels/MessageInfoBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/MessageInfoBindingModel.cs new file mode 100644 index 0000000..cedc9b7 --- /dev/null +++ b/SushiBar/SushiBarContracts/BindingModels/MessageInfoBindingModel.cs @@ -0,0 +1,14 @@ +using SushiBarDataModels.Models; + +namespace SushiBarContracts.BindingModels; + +public class MessageInfoBindingModel : IMessageInfoModel +{ + public int Id { get; set; } + public string MessageId { get; set; } = string.Empty; + public int? ClientId { get; set; } + public string SenderName { get; set; } = string.Empty; + public DateTime DateDelivery { get; set; } + public string Subject { get; set; } = string.Empty; + public string Body { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/SushiBar/SushiBarContracts/BusinessLogicsContracts/IMessageInfoLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IMessageInfoLogic.cs new file mode 100644 index 0000000..611e0dd --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IMessageInfoLogic.cs @@ -0,0 +1,14 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.BusinessLogicsContracts; + +public interface IMessageInfoLogic +{ + List? ReadList(MessageInfoSearchModel? model); + MessageInfoViewModel? ReadElement(MessageInfoSearchModel model); + bool Create(MessageInfoBindingModel model); + bool Update(MessageInfoBindingModel model); + bool Delete(MessageInfoBindingModel model); +} \ No newline at end of file diff --git a/SushiBar/SushiBarContracts/SearchModels/MessageInfoSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/MessageInfoSearchModel.cs new file mode 100644 index 0000000..cccc018 --- /dev/null +++ b/SushiBar/SushiBarContracts/SearchModels/MessageInfoSearchModel.cs @@ -0,0 +1,7 @@ +namespace SushiBarContracts.SearchModels; + +public class MessageInfoSearchModel +{ + public int? Id { get; set; } + public int? ClientId { get; set; } +} \ No newline at end of file diff --git a/SushiBar/SushiBarContracts/StoragesContracts/IMessageInfoStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IMessageInfoStorage.cs new file mode 100644 index 0000000..3a83ac5 --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/IMessageInfoStorage.cs @@ -0,0 +1,15 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.StoragesContracts; + +public interface IMessageInfoStorage +{ + List GetFullList(); + List GetFilteredList(MessageInfoSearchModel? model); + MessageInfoViewModel? GetElement(MessageInfoSearchModel model); + MessageInfoViewModel? Insert(MessageInfoBindingModel model); + MessageInfoViewModel? Update(MessageInfoBindingModel model); + MessageInfoViewModel? Delete(MessageInfoBindingModel model); +} \ No newline at end of file diff --git a/SushiBar/SushiBarContracts/ViewModels/MessageInfoViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/MessageInfoViewModel.cs new file mode 100644 index 0000000..5189e85 --- /dev/null +++ b/SushiBar/SushiBarContracts/ViewModels/MessageInfoViewModel.cs @@ -0,0 +1,17 @@ +using System.ComponentModel; +using SushiBarDataModels.Models; + +namespace SushiBarContracts.ViewModels; + +public class MessageInfoViewModel : IMessageInfoModel +{ + public int Id { get; } + public string MessageId { get; } + public int? ClientId { get; } + [DisplayName("Sender name")] + public string SenderName { get; } + [DisplayName("Date delivery")] + public DateTime DateDelivery { get; } + public string Subject { get; } + public string Body { get; } +} \ No newline at end of file diff --git a/SushiBar/SushiBarModels/Models/IMessageInfoModel.cs b/SushiBar/SushiBarModels/Models/IMessageInfoModel.cs new file mode 100644 index 0000000..0eada2c --- /dev/null +++ b/SushiBar/SushiBarModels/Models/IMessageInfoModel.cs @@ -0,0 +1,11 @@ +namespace SushiBarDataModels.Models; + +public interface IMessageInfoModel : IId +{ + string MessageId { get; } + int? ClientId { get; } + string SenderName { get; } + DateTime DateDelivery { get; } + string Subject { get; } + string Body { get; } +} \ No newline at end of file diff --git a/SushiBar/SushiBarRestApi/Controllers/ImplementerController.cs b/SushiBar/SushiBarRestApi/Controllers/ImplementerController.cs index 5841e24..6775502 100644 --- a/SushiBar/SushiBarRestApi/Controllers/ImplementerController.cs +++ b/SushiBar/SushiBarRestApi/Controllers/ImplementerController.cs @@ -47,7 +47,7 @@ public class ImplementerController : Controller { return _order.ReadList(new OrderSearchModel { - Status = OrderStatus.Accepted + Status = new List() { OrderStatus.Accepted } }); } catch (Exception ex) diff --git a/SushiBar/SushiBarRestApi/appsettings.json b/SushiBar/SushiBarRestApi/appsettings.json index 10f68b8..efa4a62 100644 --- a/SushiBar/SushiBarRestApi/appsettings.json +++ b/SushiBar/SushiBarRestApi/appsettings.json @@ -5,5 +5,11 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "SmtpClientHost": "smtp.gmail.com", + "SmtpClientPort": "587", + "PopHost": "pop.gmail.com", + "PopPort": "995", + "MailLogin": "labwork15kafis@gmail.com", + "MailPassword": "passlab15" }