31 lines
805 B
C#
31 lines
805 B
C#
|
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");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|