public ActionResult Delete(CurrencyDTO model) { try { string msg = ""; var result = _factory.Delete(model.ID, CurrentUser.UserId, ref msg); if (!result) { Response.StatusCode = (int)HttpStatusCode.BadRequest; CurrencyViewModels tmp = new CurrencyViewModels(); var listData = _factory.GetListData(); tmp.ListItem = listData; return(PartialView("_ListData", tmp)); } return(RedirectToAction("Index")); } catch (Exception ex) { NSLog.Logger.Error("Currency_Delete: ", ex); ModelState.AddModelError("Name", "Have an error when you delete a Currency"); Response.StatusCode = (int)HttpStatusCode.BadRequest; CurrencyViewModels tmp = new CurrencyViewModels(); var listData = _factory.GetListData(); tmp.ListItem = listData; return(PartialView("_ListData", tmp)); } }
// GET: SCurrency public ActionResult Index() { try { CurrencyViewModels model = new CurrencyViewModels(); return(View(model)); } catch (Exception ex) { NSLog.Logger.Error("CurrencyIndex: ", ex); return(new HttpStatusCodeResult(400, ex.Message)); } }
public ActionResult Search(CurrencyViewModels model) { try { model = new CurrencyViewModels(); var listData = _factory.GetListData(); model.ListItem = listData; } catch (Exception e) { NSLog.Logger.Error("CurrencySearch: ", e); return(new HttpStatusCodeResult(400, e.Message)); } return(PartialView("_ListData", model)); }
//get currency public string GetCurrency() { string currency = ""; CurrencyViewModels model = new CurrencyViewModels(); try { var listData = _factory.GetListData(); listData = listData.Where(x => x.IsActive == true).ToList(); model.ListItem = listData; currency = model.ListItem[0].Symbol; } catch (Exception e) { NSLog.Logger.Error("CurrencySearch: ", e); } return(currency); }
private async Task FillCurrenciesAsync(bool restore) { await Task.WhenAll(Currencies.Select(c => { var currency = CurrencyViewModelCreator.CreateViewModel(AtomexApp, c); if (currency.CurrencyCode == TezosConfig.Xtz) { TezosTokensViewModel.TezosViewModel = currency; } CurrencyViewModels.Add(currency); if (restore) { _ = currency.UpdateCurrencyAsync(); } return(Task.CompletedTask); })); }