HomeController.cs
992 bytes
| 1 | using System.Diagnostics; |
|---|---|
| 2 | using Microsoft.AspNetCore.Localization; |
| 3 | using Microsoft.AspNetCore.Mvc; |
| 4 | using SplitApp.WebApp.Models; |
| 5 | |
| 6 | namespace SplitApp.WebApp.Controllers; |
| 7 | |
| 8 | public class HomeController : Controller |
| 9 | { |
| 10 | public IActionResult Index() |
| 11 | { |
| 12 | return View(); |
| 13 | } |
| 14 | |
| 15 | public IActionResult Privacy() |
| 16 | { |
| 17 | return View(); |
| 18 | } |
| 19 | |
| 20 | public IActionResult SetLanguage(string culture, string returnUrl) |
| 21 | { |
| 22 | Response.Cookies.Append( |
| 23 | CookieRequestCultureProvider.DefaultCookieName, |
| 24 | CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)), |
| 25 | new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) } |
| 26 | ); |
| 27 | return LocalRedirect(returnUrl); |
| 28 | } |
| 29 | |
| 30 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] |
| 31 | public IActionResult Error() |
| 32 | { |
| 33 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); |
| 34 | } |
| 35 | } |
| 36 | |