...
This commit is contained in:
@@ -6,4 +6,14 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Melipayamak" Version="1.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.7" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Hushian.Application\Hushian.Application.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@@ -0,0 +1,27 @@
|
||||
using Common.Contracts.Infrastructure;
|
||||
using Hushian.Application.Models.Message;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
namespace Hushian.Infrastructure
|
||||
{
|
||||
public static class InfrastractureServicesRegistration
|
||||
{
|
||||
public static IServiceCollection ConfigureInfrastractureServices(this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
|
||||
// services.Configure<EmailSetting>(configuration.GetSection("EmailSettings"));
|
||||
//services.AddTransient<IEmailSender, EmailSender>();
|
||||
|
||||
services.Configure<MessageSetting>(configuration.GetSection("MessageSettings"));
|
||||
services.AddTransient<IMessageSender, MessageSender>();
|
||||
|
||||
|
||||
//services.Configure<aiSetting>(configuration.GetSection("aiSettings"));
|
||||
//services.AddTransient<IOpenai, OpenaiService>();
|
||||
|
||||
// services.AddScoped(c => new Melipayamak.RestClient(configuration.GetSection("MessageSettings:UserName").Value, configuration.GetSection("MessageSettings:Password").Value));
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
25
Infrastructure/Infrastructure/MessageSender.cs
Normal file
25
Infrastructure/Infrastructure/MessageSender.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
using Common.Contracts.Infrastructure;
|
||||
using Hushian.Application.Models.Message;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Hushian.Infrastructure
|
||||
{
|
||||
public class MessageSender : IMessageSender
|
||||
{
|
||||
private readonly Melipayamak.RestClient _restClient;
|
||||
private MessageSetting _msgSettings;
|
||||
public MessageSender(Melipayamak.RestClient restClient, IOptions<MessageSetting> msgSettings)
|
||||
{
|
||||
_restClient = restClient;
|
||||
_msgSettings = msgSettings.Value;
|
||||
}
|
||||
|
||||
public Task<bool> SendMassage(Message message)
|
||||
{
|
||||
string From = _msgSettings.From;
|
||||
// _restClient.Send(message.To, From, message.msg, false);
|
||||
return Task.Run(()=>true);
|
||||
}
|
||||
}
|
||||
}
|
@@ -8,9 +8,9 @@
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Reference in New Issue
Block a user