NBloodServerSupervisor/WebInterface/Controllers/CustomMapsController.cs

33 lines
999 B
C#
Raw Permalink Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WebInterface.Services;
namespace WebInterface.Controllers
{
public class CustomMapsController : Controller
{
private readonly ICustomMapService _customMapService;
public CustomMapsController(ICustomMapService customMapService)
{
_customMapService = customMapService;
}
[Route("nblood/custommaps", Name = "CustomMaps")]
public IActionResult Index()
{
var viewModel = _customMapService.ListCustomMaps();
return View(viewModel);
}
[Route("nblood/custommaps/download", Name = "DownloadCustomMap")]
public FileResult Index([FromQuery] string map)
{
byte[] customMap = _customMapService.GetCustomMapBytes(map);
return File(customMap, System.Net.Mime.MediaTypeNames.Application.Octet, map);
}
}
}