public async Task <ActionResult> Edit(string id, FormCollection collection) { try { var ticker = collection["Ticker"].ToString(); var tickerPrice = Convert.ToDouble(collection["Ticker"]); var time = Convert.ToDateTime(collection["Time"]); var fundPriceHistory = new FundPriceHistory() { Id = id, Ticker = ticker, TickerPrice = tickerPrice, Time = time }; //var fundPriceHistoryName = collection["FundPriceHistoryName"].ToString(); //var fundPriceHistory = new FundPriceHistory() //{ // Id = id, // FundPriceHistoryName = fundPriceHistoryName //}; await FundPriceHistoryLib.UpdateFundPriceHistory(fundPriceHistory); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
public async Task <ActionResult> Create(FormCollection collection) { try { var rand = new Random(); var id = rand.Next().ToString(); var ticker = collection["Ticker"].ToString(); var tickerPrice = Convert.ToDouble(collection["Ticker"]); var time = Convert.ToDateTime(collection["Time"]); var fundPriceHistory = new FundPriceHistory() { Id = id, Ticker = ticker, TickerPrice = tickerPrice, Time = time }; await FundPriceHistoryLib.InsertFundPriceHistory(fundPriceHistory); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
// GET: FundPriceHistory/Edit/5 public async Task <ActionResult> Edit(string id) { var fundPriceHistory = await FundPriceHistoryLib.GetFundPriceHistory(id.ToString()); if (fundPriceHistory == null) { var errorMsg = string.Format("FundPriceHistory {0} not found.", id); throw new HttpException(404, errorMsg); } return(View(fundPriceHistory)); }
public async Task <ActionResult> Delete(string id, FormCollection collection) { try { await FundPriceHistoryLib.DeleteFundPriceHistory(id); return(RedirectToAction("Index")); } catch { return(View()); } }
//public async void PostAsync([FromBody]string value) // In case there is a POST request, to API/Fund, we refresh the fund prices public async Task PostAsync() { var fundLib = new FundPriceHistoryLib(); await fundLib.RefreshCurrentFundPrices(); }
// GET: FundPriceHistory public async Task <ActionResult> Index() { var fundPriceHistorys = await FundPriceHistoryLib.GetAllFundPriceHistorys(); return(View(fundPriceHistorys)); }