PIbd-21_BatylkinaAO_MusoevD.../Canteen/CanteenVisitorApp/Controllers/HomeController.cs

88 lines
2.3 KiB
C#
Raw Normal View History

2023-05-14 22:24:37 +04:00
using CanteenContracts.BindingModels;
using CanteenContracts.View;
2023-04-09 19:28:29 +04:00
using CanteenVisitorApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
namespace CanteenVisitorApp.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
public IActionResult Lunches()
{
2023-05-14 22:24:37 +04:00
ViewBag.Cooks = APIClient.GetRequest<List<LunchViewModel>>("api/main/getcooklist");
2023-04-09 19:28:29 +04:00
ViewBag.Lunches = new List<LunchViewModel>();
return View();
}
[HttpGet]
public IActionResult Tablewares()
{
2023-05-14 22:24:37 +04:00
ViewBag.Tablewares = APIClient.GetRequest<List<TablewareViewModel>>("api/main/gettablewarelist");
2023-04-09 19:28:29 +04:00
return View();
}
[HttpGet]
public IActionResult Orders()
{
ViewBag.Orders = new List<OrderViewModel>();
return View();
}
[HttpGet]
public IActionResult CreateOrder()
{
ViewBag.Dishes = new List<DishViewModel>();
return View();
}
[HttpGet]
public IActionResult CreateLunch()
{
ViewBag.Products = new List<ProductViewModel>();
return View();
}
2023-05-14 22:24:37 +04:00
[HttpPost]
public void CreateTableware(string TablewareName, int TablewareCount)
{
APIClient.PostRequest("api/main/CreateTableware", new TablewareBindingModel
{
VisitorId = 1,
2023-05-18 01:40:11 +04:00
TablewareName = TablewareName
2023-05-14 22:24:37 +04:00
});
Response.Redirect("Tablewares");
}
2023-04-09 19:28:29 +04:00
[HttpGet]
public IActionResult CreateTableware()
{
ViewBag.Orders = new List<OrderViewModel>();
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}