34 lines
971 B
C#
34 lines
971 B
C#
using OFBButte.Application.Database;
|
|
using OFBButte.Application.Email;
|
|
using OFBButte.Entities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace OFBButte.Application.Missionary
|
|
{
|
|
public class AddAndSendMissionaryForm
|
|
{
|
|
private readonly AddMissionarySupportForm add;
|
|
private readonly SendMissionaryFormEmail send;
|
|
|
|
public AddAndSendMissionaryForm(IOFBContext context, IEmailSender emailSender)
|
|
{
|
|
add = new AddMissionarySupportForm(context);
|
|
send = new SendMissionaryFormEmail(context, emailSender);
|
|
}
|
|
|
|
public async Task<MissionarySupport> Handle(MissionarySupport form, string emailAddress)
|
|
{
|
|
var added = add.Handle(form);
|
|
if (added == null)
|
|
{
|
|
return null;
|
|
}
|
|
await send.Handle(added.Id, emailAddress);
|
|
return added;
|
|
}
|
|
}
|
|
}
|