using MediatR; using Microsoft.AspNetCore.Mvc; using Sledgemapper.Api.Handlers; using Sledgemapper.Shared.Entities; using System.Threading.Tasks; namespace Sledgemapper.Api.Controllers { [Route("[controller]/{sessionName}")] public class SessionController : ControllerBase { private readonly IMediator _mediator; public SessionController(IMediator mediator) { _mediator = mediator; } [HttpPost("tile")] public async Task Post(string sessionName, [FromBody]Tile tile) { await _mediator.Publish(new NewTileNotification(sessionName, tile)); } [HttpPost("overlay")] public async Task Post(string sessionName, [FromBody]Overlay overlay) { await _mediator.Publish(new NewOverlayNotification(sessionName, overlay)); } [HttpPost("wall")] public async Task Post(string sessionName, [FromBody]Wall wall) { await _mediator.Publish(new NewWallNotification(sessionName, wall)); } [HttpDelete("tile")] public async Task Delete(string sessionName, [FromBody]Tile tile) { await _mediator.Publish(new DeleteTileNotification(sessionName, tile)); } [HttpDelete("overlay")] public async Task Delete(string sessionName, [FromBody]Overlay overlay) { await _mediator.Publish(new DeleteOverlayNotification(sessionName, overlay)); } [HttpDelete("wall")] public async Task Delete(string sessionName, [FromBody]Wall wall) { await _mediator.Publish(new DeleteWallNotification(sessionName, wall)); } } }