public async Task<IActionResult> CurrencyEdit(CurrencyViewModel model) { ViewBag.Title = "Edit Currency"; ViewBag.Heading = "Edit Currency"; if (!ModelState.IsValid) { return View(model); } string successFormat; ICurrency currency = null; if (model.Guid != Guid.Empty) { currency = await dataManager.FetchCurrency(model.Guid); successFormat = "The currency <b>{0}</b> was successfully updated."; } else { currency = new Currency(); successFormat = "The currency <b>{0}</b> was successfully created."; } currency.Code = model.Code; currency.Title = model.Title; bool result = await dataManager.Save(currency); if (result) { this.AlertSuccess(string.Format(successFormat, currency.Title), true); } return RedirectToAction("CurrencyList"); }
public async Task<IActionResult> CurrencyEdit(Guid? currencyGuid) { ViewBag.Title = "Edit Currency"; ViewBag.Heading = "Edit Currency"; CurrencyViewModel model = new CurrencyViewModel(); if (currencyGuid.HasValue) { ICurrency currency = await dataManager.FetchCurrency(currencyGuid.Value); model.Guid = currency.Guid; model.Title = currency.Title; model.Code = currency.Code; //var node = SiteMaps.Current.FindSiteMapNodeFromKey("CurrencyEdit"); //if (node != null) //{ // node.Title = "Edit Currency"; //} } return View(model); }