From b9543b2e000245ad49f2fe5e97c356afce64d2db Mon Sep 17 00:00:00 2001 From: Leozillo73 <76777036+Leozillo73@users.noreply.github.com> Date: Wed, 15 May 2024 21:08:59 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=207?= =?UTF-8?q?=20=D0=BB=D0=B0=D0=B1=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...240515151802_InitialMigration.Designer.cs} | 49 +++++++++++- ....cs => 20240515151802_InitialMigration.cs} | 31 ++++++- .../FishFactoryDatabaseModelSnapshot.cs | 45 ++++++++++- .../DataFileSingleton.cs | 4 + .../Implements/MessageInfoStorage.cs | 58 ++++++++++++++ .../Models/MessageInfo.cs | 80 +++++++++++++++++++ .../DataListSingleton.cs | 2 + .../Implements/MessageInfoStorage.cs | 68 ++++++++++++++++ .../Models/MessageInfo.cs | 53 ++++++++++++ FishFactory/FishFactoryRestApi/Program.cs | 2 +- .../FishFactoryRestApi/appsettings.json | 4 +- FishFactory/FishFactoryView/App.config | 4 +- FishFactory/FishFactoryView/Program.cs | 44 +++++----- 13 files changed, 411 insertions(+), 33 deletions(-) rename FishFactory/FishFactoryDatabaseImplement/Migrations/{20240430182657_InitialCreate.Designer.cs => 20240515151802_InitialMigration.Designer.cs} (84%) rename FishFactory/FishFactoryDatabaseImplement/Migrations/{20240430182657_InitialCreate.cs => 20240515151802_InitialMigration.cs} (84%) create mode 100644 FishFactory/FishFactoryFileImplement/Implements/MessageInfoStorage.cs create mode 100644 FishFactory/FishFactoryFileImplement/Models/MessageInfo.cs create mode 100644 FishFactory/FishFactoryListImplement/Implements/MessageInfoStorage.cs create mode 100644 FishFactory/FishFactoryListImplement/Models/MessageInfo.cs diff --git a/FishFactory/FishFactoryDatabaseImplement/Migrations/20240430182657_InitialCreate.Designer.cs b/FishFactory/FishFactoryDatabaseImplement/Migrations/20240515151802_InitialMigration.Designer.cs similarity index 84% rename from FishFactory/FishFactoryDatabaseImplement/Migrations/20240430182657_InitialCreate.Designer.cs rename to FishFactory/FishFactoryDatabaseImplement/Migrations/20240515151802_InitialMigration.Designer.cs index ac3bcba..3b52469 100644 --- a/FishFactory/FishFactoryDatabaseImplement/Migrations/20240430182657_InitialCreate.Designer.cs +++ b/FishFactory/FishFactoryDatabaseImplement/Migrations/20240515151802_InitialMigration.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace FishFactoryDatabaseImplement.Migrations { [DbContext(typeof(FishFactoryDatabase))] - [Migration("20240430182657_InitialCreate")] - partial class InitialCreate + [Migration("20240515151802_InitialMigration")] + partial class InitialMigration { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -143,6 +143,36 @@ namespace FishFactoryDatabaseImplement.Migrations b.ToTable("Implementers"); }); + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.MessageInfo", b => + { + b.Property("MessageId") + .HasColumnType("nvarchar(450)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("DateDelivery") + .HasColumnType("datetime2"); + + b.Property("SenderName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MessageId"); + + b.HasIndex("ClientId"); + + b.ToTable("MessageInfos"); + }); + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b => { b.Property("Id") @@ -205,6 +235,15 @@ namespace FishFactoryDatabaseImplement.Migrations b.Navigation("Component"); }); + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.MessageInfo", b => + { + b.HasOne("FishFactoryDatabaseImplement.Models.Client", "Client") + .WithMany("ClientMessages") + .HasForeignKey("ClientId"); + + b.Navigation("Client"); + }); + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b => { b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned") @@ -214,7 +253,7 @@ namespace FishFactoryDatabaseImplement.Migrations .IsRequired(); b.HasOne("FishFactoryDatabaseImplement.Models.Client", "Client") - .WithMany("Orders") + .WithMany("ClientOrders") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -239,7 +278,9 @@ namespace FishFactoryDatabaseImplement.Migrations modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Client", b => { - b.Navigation("Orders"); + b.Navigation("ClientMessages"); + + b.Navigation("ClientOrders"); }); modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Component", b => diff --git a/FishFactory/FishFactoryDatabaseImplement/Migrations/20240430182657_InitialCreate.cs b/FishFactory/FishFactoryDatabaseImplement/Migrations/20240515151802_InitialMigration.cs similarity index 84% rename from FishFactory/FishFactoryDatabaseImplement/Migrations/20240430182657_InitialCreate.cs rename to FishFactory/FishFactoryDatabaseImplement/Migrations/20240515151802_InitialMigration.cs index 6e6c18a..e04ef11 100644 --- a/FishFactory/FishFactoryDatabaseImplement/Migrations/20240430182657_InitialCreate.cs +++ b/FishFactory/FishFactoryDatabaseImplement/Migrations/20240515151802_InitialMigration.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace FishFactoryDatabaseImplement.Migrations { /// - public partial class InitialCreate : Migration + public partial class InitialMigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -70,6 +70,27 @@ namespace FishFactoryDatabaseImplement.Migrations table.PrimaryKey("PK_Implementers", x => x.Id); }); + migrationBuilder.CreateTable( + name: "MessageInfos", + columns: table => new + { + MessageId = table.Column(type: "nvarchar(450)", nullable: false), + ClientId = table.Column(type: "int", nullable: true), + SenderName = table.Column(type: "nvarchar(max)", nullable: false), + DateDelivery = table.Column(type: "datetime2", nullable: false), + Subject = table.Column(type: "nvarchar(max)", nullable: false), + Body = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MessageInfos", x => x.MessageId); + table.ForeignKey( + name: "FK_MessageInfos_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id"); + }); + migrationBuilder.CreateTable( name: "CannedComponents", columns: table => new @@ -144,6 +165,11 @@ namespace FishFactoryDatabaseImplement.Migrations table: "CannedComponents", column: "ComponentId"); + migrationBuilder.CreateIndex( + name: "IX_MessageInfos_ClientId", + table: "MessageInfos", + column: "ClientId"); + migrationBuilder.CreateIndex( name: "IX_Orders_CannedId", table: "Orders", @@ -166,6 +192,9 @@ namespace FishFactoryDatabaseImplement.Migrations migrationBuilder.DropTable( name: "CannedComponents"); + migrationBuilder.DropTable( + name: "MessageInfos"); + migrationBuilder.DropTable( name: "Orders"); diff --git a/FishFactory/FishFactoryDatabaseImplement/Migrations/FishFactoryDatabaseModelSnapshot.cs b/FishFactory/FishFactoryDatabaseImplement/Migrations/FishFactoryDatabaseModelSnapshot.cs index 7b05d00..0d4f480 100644 --- a/FishFactory/FishFactoryDatabaseImplement/Migrations/FishFactoryDatabaseModelSnapshot.cs +++ b/FishFactory/FishFactoryDatabaseImplement/Migrations/FishFactoryDatabaseModelSnapshot.cs @@ -140,6 +140,36 @@ namespace FishFactoryDatabaseImplement.Migrations b.ToTable("Implementers"); }); + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.MessageInfo", b => + { + b.Property("MessageId") + .HasColumnType("nvarchar(450)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("DateDelivery") + .HasColumnType("datetime2"); + + b.Property("SenderName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MessageId"); + + b.HasIndex("ClientId"); + + b.ToTable("MessageInfos"); + }); + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b => { b.Property("Id") @@ -202,6 +232,15 @@ namespace FishFactoryDatabaseImplement.Migrations b.Navigation("Component"); }); + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.MessageInfo", b => + { + b.HasOne("FishFactoryDatabaseImplement.Models.Client", "Client") + .WithMany("ClientMessages") + .HasForeignKey("ClientId"); + + b.Navigation("Client"); + }); + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b => { b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned") @@ -211,7 +250,7 @@ namespace FishFactoryDatabaseImplement.Migrations .IsRequired(); b.HasOne("FishFactoryDatabaseImplement.Models.Client", "Client") - .WithMany("Orders") + .WithMany("ClientOrders") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -236,7 +275,9 @@ namespace FishFactoryDatabaseImplement.Migrations modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Client", b => { - b.Navigation("Orders"); + b.Navigation("ClientMessages"); + + b.Navigation("ClientOrders"); }); modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Component", b => diff --git a/FishFactory/FishFactoryFileImplement/DataFileSingleton.cs b/FishFactory/FishFactoryFileImplement/DataFileSingleton.cs index 7e9dedd..8bcc5e9 100644 --- a/FishFactory/FishFactoryFileImplement/DataFileSingleton.cs +++ b/FishFactory/FishFactoryFileImplement/DataFileSingleton.cs @@ -10,12 +10,14 @@ namespace FishFactoryFileImplement private readonly string CannedFileName = "Canned.xml"; private readonly string ClientFileName = "Client.xml"; private readonly string ImplementerFileName = "Implementer.xml"; + private readonly string MessageInfoFileName = "MessageInfo.xml"; public List Components { get; private set; } public List Orders { get; private set; } public List Canneds { get; private set; } public List Clients { get; private set; } public List Implementers { get; private set; } + public List Messages { get; private set; } public static DataFileSingleton GetInstance() { if (instance == null) @@ -31,6 +33,7 @@ namespace FishFactoryFileImplement public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement); public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement); public void SaveImplementers() => SaveData(Implementers, ImplementerFileName, "Implementers", x => x.GetXElement); + public void SaveMessages() => SaveData(Orders, ImplementerFileName, "Messages", x => x.GetXElement); private DataFileSingleton() { Components = LoadData(ComponentFileName, "Component", x => @@ -41,6 +44,7 @@ namespace FishFactoryFileImplement Order.Create(x)!)!; Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!; Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!; + Messages = LoadData(MessageInfoFileName, "MessageInfo", x => MessageInfo.Create(x)!)!; } private static List? LoadData(string filename, string xmlNodeName, Func selectFunction) diff --git a/FishFactory/FishFactoryFileImplement/Implements/MessageInfoStorage.cs b/FishFactory/FishFactoryFileImplement/Implements/MessageInfoStorage.cs new file mode 100644 index 0000000..8786903 --- /dev/null +++ b/FishFactory/FishFactoryFileImplement/Implements/MessageInfoStorage.cs @@ -0,0 +1,58 @@ +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.SearchModels; +using FishFactoryContracts.StoragesContracts; +using FishFactoryContracts.ViewModels; +using FishFactoryFileImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FishFactoryFileImplement.Implements +{ + public class MessageInfoStorage : IMessageInfoStorage + { + private readonly DataFileSingleton _source; + public MessageInfoStorage() + { + _source = DataFileSingleton.GetInstance(); + } + + public MessageInfoViewModel? GetElement(MessageInfoSearchModel model) + { + if (model.MessageId != null) + { + return _source.Messages.FirstOrDefault(x => x.MessageId == model.MessageId)?.GetViewModel; + } + return null; + } + + public List GetFilteredList(MessageInfoSearchModel model) + { + return _source.Messages + .Where(x => x.ClientId == model.ClientId) + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + return _source.Messages + .Select(x => x.GetViewModel) + .ToList(); + } + + public MessageInfoViewModel? Insert(MessageInfoBindingModel model) + { + var newMessage = MessageInfo.Create(model); + if (newMessage == null) + { + return null; + } + _source.Messages.Add(newMessage); + _source.SaveMessages(); + return newMessage.GetViewModel; + } + } +} \ No newline at end of file diff --git a/FishFactory/FishFactoryFileImplement/Models/MessageInfo.cs b/FishFactory/FishFactoryFileImplement/Models/MessageInfo.cs new file mode 100644 index 0000000..8fe9aa3 --- /dev/null +++ b/FishFactory/FishFactoryFileImplement/Models/MessageInfo.cs @@ -0,0 +1,80 @@ +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.ViewModels; +using FishFactoryDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace FishFactoryFileImplement.Models +{ + public class MessageInfo : IMessageInfoModel + { + public string MessageId { get; private set; } = string.Empty; + + public int? ClientId { get; private set; } + + public string SenderName { get; private set; } = string.Empty; + + public DateTime DateDelivery { get; private set; } = DateTime.Now; + + public string Subject { get; private set; } = string.Empty; + + public string Body { get; private set; } = string.Empty; + + public static MessageInfo? Create(MessageInfoBindingModel model) + { + if (model == null) + { + return null; + } + return new() + { + Body = model.Body, + Subject = model.Subject, + ClientId = model.ClientId, + MessageId = model.MessageId, + SenderName = model.SenderName, + DateDelivery = model.DateDelivery, + }; + } + + public static MessageInfo? Create(XElement element) + { + if (element == null) + { + return null; + } + return new() + { + Body = element.Attribute("Body")!.Value, + Subject = element.Attribute("Subject")!.Value, + ClientId = Convert.ToInt32(element.Attribute("ClientId")!.Value), + MessageId = element.Attribute("MessageId")!.Value, + SenderName = element.Attribute("SenderName")!.Value, + DateDelivery = Convert.ToDateTime(element.Attribute("DateDelivery")!.Value), + }; + } + + public MessageInfoViewModel GetViewModel => new() + { + Body = Body, + Subject = Subject, + ClientId = ClientId, + MessageId = MessageId, + SenderName = SenderName, + DateDelivery = DateDelivery, + }; + + public XElement GetXElement => new("MessageInfo", + new XAttribute("Body", Body), + new XAttribute("Subject", Subject), + new XAttribute("ClientId", ClientId), + new XAttribute("MessageId", MessageId), + new XAttribute("SenderName", SenderName), + new XAttribute("DateDelivery", DateDelivery) + ); + } +} \ No newline at end of file diff --git a/FishFactory/FishFactoryListImplement/DataListSingleton.cs b/FishFactory/FishFactoryListImplement/DataListSingleton.cs index 7f0efc3..dd24e1c 100644 --- a/FishFactory/FishFactoryListImplement/DataListSingleton.cs +++ b/FishFactory/FishFactoryListImplement/DataListSingleton.cs @@ -15,6 +15,7 @@ namespace FishFactoryListImplement public List Canneds { get; set; } public List Clients { get; set; } public List Implementers { get; set; } + public List Messages { get; set; } private DataListSingleton() { @@ -23,6 +24,7 @@ namespace FishFactoryListImplement Canneds = new List(); Clients = new List(); Implementers = new List(); + Messages = new List(); } public static DataListSingleton GetInstance() { diff --git a/FishFactory/FishFactoryListImplement/Implements/MessageInfoStorage.cs b/FishFactory/FishFactoryListImplement/Implements/MessageInfoStorage.cs new file mode 100644 index 0000000..e5ff1b9 --- /dev/null +++ b/FishFactory/FishFactoryListImplement/Implements/MessageInfoStorage.cs @@ -0,0 +1,68 @@ +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.SearchModels; +using FishFactoryContracts.StoragesContracts; +using FishFactoryContracts.ViewModels; +using FishFactoryListImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FishFactoryListImplement.Implements +{ + public class MessageInfoStorage : IMessageInfoStorage + { + private readonly DataListSingleton _source; + public MessageInfoStorage() + { + _source = DataListSingleton.GetInstance(); + } + + public List GetFullList() + { + List result = new(); + foreach (var item in _source.Messages) + { + result.Add(item.GetViewModel); + } + return result; + } + + public List GetFilteredList(MessageInfoSearchModel model) + { + List result = new(); + foreach (var item in _source.Messages) + { + if (item.ClientId.HasValue && item.ClientId == model.ClientId) + { + result.Add(item.GetViewModel); + } + } + return result; + } + + public MessageInfoViewModel? GetElement(MessageInfoSearchModel model) + { + foreach (var message in _source.Messages) + { + if (model.MessageId != null && model.MessageId.Equals(message.MessageId)) + { + return message.GetViewModel; + } + } + return null; + } + + public MessageInfoViewModel? Insert(MessageInfoBindingModel model) + { + var newMessage = MessageInfo.Create(model); + if (newMessage == null) + { + return null; + } + _source.Messages.Add(newMessage); + return newMessage.GetViewModel; + } + } +} \ No newline at end of file diff --git a/FishFactory/FishFactoryListImplement/Models/MessageInfo.cs b/FishFactory/FishFactoryListImplement/Models/MessageInfo.cs new file mode 100644 index 0000000..ed4f15f --- /dev/null +++ b/FishFactory/FishFactoryListImplement/Models/MessageInfo.cs @@ -0,0 +1,53 @@ +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.ViewModels; +using FishFactoryDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FishFactoryListImplement.Models +{ + public class MessageInfo : IMessageInfoModel + { + public string MessageId { get; private set; } = string.Empty; + + public int? ClientId { get; private set; } + + public string SenderName { get; private set; } = string.Empty; + + public DateTime DateDelivery { get; private set; } = DateTime.Now; + + public string Subject { get; private set; } = string.Empty; + + public string Body { get; private set; } = string.Empty; + + public static MessageInfo? Create(MessageInfoBindingModel model) + { + if (model == null) + { + return null; + } + return new() + { + Body = model.Body, + Subject = model.Subject, + ClientId = model.ClientId, + MessageId = model.MessageId, + SenderName = model.SenderName, + DateDelivery = model.DateDelivery, + }; + } + + public MessageInfoViewModel GetViewModel => new() + { + Body = Body, + Subject = Subject, + ClientId = ClientId, + MessageId = MessageId, + SenderName = SenderName, + DateDelivery = DateDelivery, + }; + } +} \ No newline at end of file diff --git a/FishFactory/FishFactoryRestApi/Program.cs b/FishFactory/FishFactoryRestApi/Program.cs index 67d8436..8424bf9 100644 --- a/FishFactory/FishFactoryRestApi/Program.cs +++ b/FishFactory/FishFactoryRestApi/Program.cs @@ -5,7 +5,7 @@ using FishFactoryDatabaseImplement.Implements; using FishFactoryBusinessLogic.MailWorker; using FishFactoryContracts.BindingModels; using Microsoft.OpenApi.Models; -using PizzeriaBusinessLogic.MailWorker; +using FishFactoryBusinessLogic.MailWorker; var builder = WebApplication.CreateBuilder(args); builder.Logging.SetMinimumLevel(LogLevel.Trace); diff --git a/FishFactory/FishFactoryRestApi/appsettings.json b/FishFactory/FishFactoryRestApi/appsettings.json index 83d0f9f..d09bc30 100644 --- a/FishFactory/FishFactoryRestApi/appsettings.json +++ b/FishFactory/FishFactoryRestApi/appsettings.json @@ -11,6 +11,6 @@ "SmtpClientPort": "587", "PopHost": "pop.gmail.com", "PopPort": "995", - "MailLogin": "labworkdanilkashtanov123@gmail.com", - "MailPassword": "passlab15" + "MailLogin": "labwork7daniel@gmail.com", + "MailPassword": "ivjc qnvg yfdq vvwk" } diff --git a/FishFactory/FishFactoryView/App.config b/FishFactory/FishFactoryView/App.config index 3df9407..e4b63c4 100644 --- a/FishFactory/FishFactoryView/App.config +++ b/FishFactory/FishFactoryView/App.config @@ -5,7 +5,7 @@ - - + + diff --git a/FishFactory/FishFactoryView/Program.cs b/FishFactory/FishFactoryView/Program.cs index 9fb6981..1bc2b46 100644 --- a/FishFactory/FishFactoryView/Program.cs +++ b/FishFactory/FishFactoryView/Program.cs @@ -60,38 +60,40 @@ namespace FishFactoryView option.AddNLog("nlog.config"); }); services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddSingleton(); services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddSingleton(); + services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } private static void MailCheck(object obj) => ServiceProvider?.GetService()?.MailCheck(); }