using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using OFBButte.Application.Configuration; using OFBButte.Application.Database; using OFBButte.Application.Email; using OFBButte.Application.Missionary; using OFBButte.Entities; namespace OFBButte.Api.Controllers { [Route("api/[controller]")] [ApiController] public class MissionaryController : ControllerBase { private readonly AppSettings appSettings; private readonly IOFBContext context; private readonly IEmailSender emailSender; public MissionaryController(IOptions options, IOFBContext context, IEmailSender emailSender) { this.appSettings = options.Value; this.context = context; this.emailSender = emailSender; } [HttpPost] public async Task> Post([FromBody] MissionarySupport value) { var adder = new AddAndSendMissionaryForm(context, emailSender); var result = await adder.Handle(value, appSettings.MissionaryEmailAddress); return result; } [HttpGet("{id}")] public ActionResult Get(int id) { throw new NotImplementedException(); var getter = new GetMissionarySupportForm(context); var result = getter.Handle(id); return result; } } }