CourseWork_SchoolStudyAgain/SchoolAgainStudy/TeacherWebClient/Controllers/HomeController.cs
2023-05-17 21:29:39 +04:00

52 lines
1.4 KiB
C#

using Microsoft.AspNetCore.Mvc;
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.BusinessLogicContracts;
using System.Diagnostics;
using TeacherWebClient.Models;
namespace TeacherWebClient.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IProductLogic _product;
private readonly ILessonLogic _lesson;
private readonly ITaskLogic _task;
private readonly IMaterialLogic _material;
private readonly ITeacherLogic _teacher;
public HomeController(ILogger<HomeController> logger, IProductLogic product, ILessonLogic lesson, ITaskLogic task, IMaterialLogic material, ITeacherLogic teacher)
{
_logger = logger;
_product = product;
_lesson = lesson;
_task = task;
_material = material;
_teacher = teacher;
}
[HttpGet]
public IActionResult Index()
{
if (APIClient.Teacher == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
public IActionResult Privacy()
{
if (APIClient.Teacher == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.Teacher);
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}