I am having a futher issue here. In asp.net 5 and mvc
I want to have a dropdown with currency the part of selection and identifying which works
[HttpPost]
public IActionResult SetCurrency(IFormCollection forms,string returnUrl)
{
string storeLocale = forms["customerCurrency"].ToString();
var record = _context.Currencies.Where(w => w.DisplayLocale == storeLocale).FirstOrDefault();
var currentLanguageId = _context.Appsettings.Where(w => w.Key == Constants.FrontEndDefaultLanguageId).FirstOrDefault();
if (record != null)
{
_config[Constants.FrontEndDefaultLanguageId] = record.Id.ToString();
currentLanguageId.Value = record.Id.ToString();
_context.SaveChanges();
_toast.AddAlertToastMessage("Currecy changed to " + record.Name);
}
return LocalRedirect(returnUrl);
}
For my culture I am doing this which is control by the language dropdown
[HttpPost]
public IActionResult SetCulture(string culture, string returnUrl)
{
var record = _context.Appsettings.Where(w => w.Key == Constants.FrontEndDefaultLanguageId).FirstOrDefault();
if (culture == "en")
record.Value = "1";
if (culture == "fr")
record.Value = "2";
_context.SaveChangesAsync();
_toast.AddSuccessToastMessage("Language changed to :" + record.Key);
Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) }
);
return LocalRedirect(returnUrl);
}
I don't want SetCurrency to override what has been set in the cookie but i want it to set if it would use the euro pound symbol etc so I think I need Number Info but am not sure how I would set it in this case.
Buy this i mean the
£ or the Euro symbol at present another square symbol is showing up even though my culture is set to fr-fr for france
