[HttpPost] // [ValidateAntiForgeryToken] public async Task <IActionResult> Create([Bind(properties)] CurrencyViewModel c) { await validateId(c.IsoCode, ModelState); if (!ModelState.IsValid) { return(View(c)); } var o = CurrencyObjectFactory.Create(c.IsoCode, c.Name, c.Symbol, c.ValidFrom, c.ValidTo); await repository.AddObject(o); return(RedirectToAction("Index")); }
public static void Initialize(ICurrencyObjectsRepository c) { if (c.IsInitialized()) { return; } var regions = SystemRegionInfo.GetRegionsList(); foreach (var r in regions) { if (!SystemRegionInfo.IsCountry(r)) { continue; } var e = CurrencyObjectFactory.Create(r); c.AddObject(e); } }