Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- public void SetTheme(string data)
- {
- HttpCookie cookie = new HttpCookie("theme");
- cookie.Value = data;
- cookie.Expires = DateTime.Now.AddDays(1);
- Response.Cookies.Add(cookie);
- }
- [HttpPost]
- public void ChangeLanguage(string data)
- {
- HttpCookie cookie = new HttpCookie("language");
- cookie.Value = data;
- cookie.Expires = DateTime.Now.AddDays(1);
- Response.Cookies.Add(cookie);
- }
- [HttpPost]
- public async Task SetCurrency(string code)
- {
- HttpCookie cookie = new HttpCookie("currency");
- if (code == "pln")
- {
- cookie.Values.Add("name", "złotówka");
- cookie.Values.Add("code", "pln");
- cookie.Values.Add("value", "1");
- }
- else
- {
- CurrencyClient client = new CurrencyClient();
- CurrencyObject currency = await client.GetCurrencyAsync("a", code);
- cookie.Values.Add("name", currency.Currency);
- cookie.Values.Add("code", currency.Code);
- cookie.Values.Add("value", currency.Rates[0].Mid.ToString());
- }
- cookie.Expires = DateTime.Now.AddDays(1);
- Response.Cookies.Add(cookie);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement