83 lines
2.3 KiB
C#
83 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using TodoAPI2.Models;
|
|
using STAFF_API.Models;
|
|
using Microsoft.Extensions.Logging;
|
|
using TodoAPI2.Controllers;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace TodoAPI2.Controllers
|
|
{
|
|
public class homeController : Controller
|
|
{
|
|
private IConfiguration Configuration { get; set; }
|
|
private Iexternal_employeeService emp;
|
|
|
|
/// <summary>
|
|
/// Default constructure for dependency injection
|
|
/// </summary>
|
|
/// <param name="inemp"></param>
|
|
/// <param name="configuration"></param>
|
|
public homeController(Iexternal_employeeService inemp, IConfiguration configuration)
|
|
{
|
|
Configuration = configuration;
|
|
emp = inemp;
|
|
}
|
|
|
|
public IActionResult logout()
|
|
{
|
|
Response.Cookies.Delete("emp_name");
|
|
Response.Cookies.Delete("user_id");
|
|
Response.Cookies.Delete("emp_id");
|
|
|
|
string mainsite = MyHelper.GetConfig(Configuration, "SiteInformation:mainsite");
|
|
|
|
return Redirect(mainsite + "/logout");
|
|
}
|
|
|
|
public IActionResult index2()
|
|
{
|
|
MyHelper.get_login(HttpContext, emp, Response);
|
|
|
|
return View();
|
|
}
|
|
|
|
public IActionResult index_report()
|
|
{
|
|
MyHelper.get_login(HttpContext, emp, Response);
|
|
|
|
return View();
|
|
}
|
|
|
|
public IActionResult testlogin()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public IActionResult dotestlogin()
|
|
{
|
|
if (!string.IsNullOrEmpty(HttpContext.Request.Query["user_id"]))
|
|
{
|
|
CookieOptions option = new CookieOptions();
|
|
Response.Cookies.Delete("user_id");
|
|
Response.Cookies.Append("user_id", HttpContext.Request.Query["user_id"], option);
|
|
}
|
|
|
|
return Redirect("/eva/home/index2");
|
|
}
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
public IActionResult Error()
|
|
{
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
}
|
|
}
|
|
}
|
|
|
|
|