using CanteenContracts.BindingModels; using CanteenContracts.View; using CanteenVisitorApp.Models; using Microsoft.AspNetCore.Mvc; using System.Diagnostics; namespace CanteenVisitorApp.Controllers { public class HomeController : Controller { private readonly ILogger _logger; public HomeController(ILogger logger) { _logger = logger; } public IActionResult Index() { return View(); } public IActionResult Privacy() { return View(); } public IActionResult Lunches() { ViewBag.Cooks = APIClient.GetRequest>("api/main/getcooklist"); ViewBag.Lunches = new List(); return View(); } [HttpGet] public IActionResult Tablewares() { ViewBag.Tablewares = APIClient.GetRequest>("api/main/gettablewarelist"); return View(); } [HttpGet] public IActionResult Orders() { ViewBag.Orders = new List(); return View(); } [HttpGet] public IActionResult CreateOrder() { ViewBag.Dishes = new List(); return View(); } [HttpGet] public IActionResult CreateLunch() { ViewBag.Products = new List(); return View(); } [HttpPost] public void CreateTableware(string TablewareName, int TablewareCount) { APIClient.PostRequest("api/main/CreateTableware", new TablewareBindingModel { VisitorId = 1, TablewareName = TablewareName, Count = TablewareCount }); Response.Redirect("Tablewares"); } [HttpGet] public IActionResult CreateTableware() { ViewBag.Orders = new List(); return View(); } [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } } }