auto.bus_api/Server/Controllers/TestingController.cs
cuqmbr 95028ed18b feat: many thing
- Database model
- Data transfer objects
- Country management controller
2022-10-10 20:34:09 +03:00

32 lines
745 B
C#

using Microsoft.AspNetCore.Mvc;
namespace Server.Controllers;
[Route("api/[controller]")]
[ApiController]
public class TestingController : ControllerBase
{
[HttpPost("timezone")]
public async Task<IActionResult> SetTimeZone(string timeZone)
{
var cookieOptions = new CookieOptions()
{
Expires = DateTimeOffset.MaxValue
};
Response.Cookies.Append("timeZone", timeZone, cookieOptions);
return Ok();
}
[HttpGet("timezone")]
public async Task<IActionResult> GetTimeZone()
{
if (Request.Cookies.TryGetValue("timeZone", out string? tz))
{
return Ok(tz);
}
return NotFound();
}
}