46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
using CarServiceBusinessLogic.BusinessLogics;
|
|
using CarServiceContracts.BusinessLogicsContracts;
|
|
using CarServiceWebApp.Models;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Diagnostics;
|
|
|
|
namespace CarServiceWebApp.Controllers
|
|
{
|
|
public class HomeController : Controller
|
|
{
|
|
private readonly ILogger<HomeController> _logger;
|
|
private readonly IWorkLogic _workLogic;
|
|
|
|
public HomeController(ILogger<HomeController> logger, IWorkLogic workLogic)
|
|
{
|
|
_logger = logger;
|
|
_workLogic = workLogic;
|
|
}
|
|
|
|
public IActionResult Index()
|
|
{
|
|
if (CurrentUser.UserId < 1)
|
|
{
|
|
return Redirect("~/Home/Enter");
|
|
}
|
|
return View();
|
|
}
|
|
|
|
public IActionResult Enter()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public IActionResult Works()
|
|
{
|
|
ViewBag.Works = _workLogic.ReadList(new() { Id = 1 });
|
|
return View();
|
|
}
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
public IActionResult Error()
|
|
{
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
}
|
|
}
|
|
} |