API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MailController.cs 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.AspNetCore.Mvc;
  7. using UnivateProperties_API.Model.Communication;
  8. using UnivateProperties_API.Repository.Communication;
  9. namespace UnivateProperties_API.Controllers.Communication
  10. {
  11. [Route("api/[controller]")]
  12. [ApiController]
  13. public class MailController : ControllerBase
  14. {
  15. private readonly IMailRepository _repo;
  16. public MailController(IMailRepository repo)
  17. {
  18. _repo = repo;
  19. }
  20. [HttpPost("{id}")]
  21. public IActionResult Post(int id, [FromBody] MailModel mm)
  22. {
  23. try
  24. {
  25. switch (id)
  26. {
  27. case 0:
  28. _repo.ContactUs(mm);
  29. break;
  30. }
  31. return new OkResult();
  32. }
  33. catch
  34. {
  35. return new BadRequestResult();
  36. }
  37. }
  38. }
  39. }