Manarah/Manarah.App/Controllers/ServersController.cs
2024-03-28 22:29:14 +00:00
Ask

31 lines
805 B
C#

{dbb43a82e3b8d6e550ad92a21bbc1d9b01859970 true 805 ServersController.cs 0xc001e2aa10}

using Manarah.App.Services;
using Manarah.Domain;
using Microsoft.AspNetCore.Mvc;
namespace Manarah.App.Controllers
{
public class ServersController : Controller
{
private readonly ServerService _serverService;
public ServersController(ServerService serverService)
{
_serverService= serverService;
}
public async Task<IActionResult> IndexAsync()
{
var serverList= await _serverService.GetServersAsync();
return View(serverList);
}
public IActionResult Add()
{
return View();
}
[HttpPost]
public IActionResult Add(Server server)
{
_serverService.AddServer(server);
return RedirectToAction("index");
}
}
}