using api.Interfaces; using Microsoft.AspNetCore.Mvc; using models.Core; using models.Request; namespace api.Controllers; /// /// Endpoints for Event Management /// /// Event Manager Service [ApiController] [Route("[controller]")] public class EventController(IEventManager eventManager) : ControllerBase { [HttpPost] public ActionResult Post([FromBody] AddEvent request) { //TODO: Protect Endpoint try { eventManager.AddEvent(request); return Ok(); } catch (Exception e) { return BadRequest(e.Message); } } /// /// Updates an Event /// /// New Event Information /// [HttpPatch] public ActionResult Patch([FromBody] PatchEvent request) { //TODO: Protect Endpoint try { eventManager.PatchEvent(request); return Ok(); } catch (Exception e) { return BadRequest(e.Message); } } /// /// Gets a list of all events between a start date and an end date /// /// Start date for the event search /// End date for the event search /// [HttpGet] public ActionResult> Get(DateTime startDate, DateTime endDate) { try { return Ok(eventManager.GetEvents(startDate, endDate)); } catch (Exception e) { return BadRequest(e.Message); } } }