1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using UnivateProperties_API.Model.Communication;
- using UnivateProperties_API.Repository.Communication;
-
- namespace UnivateProperties_API.Controllers.Communication
- {
- [Route("api/[controller]")]
- [ApiController]
- public class MailController : ControllerBase
- {
- private readonly IMailRepository _repo;
- public MailController(IMailRepository repo)
- {
- _repo = repo;
- }
-
- [HttpPost("{id}")]
- public IActionResult Post(int id, [FromBody] MailModel mm)
- {
- try
- {
- switch (id)
- {
- case 0:
- _repo.ContactUs(mm);
- break;
- case 1:
- _repo.EnquireNow(mm);
- break;
- }
- return new OkResult();
- }
- catch
- {
- return new BadRequestResult();
- }
- }
- }
- }
|