public async Task <IActionResult> Edit(string id, [Bind("Id,Date,StockId,Open,High,Low,Close,LastClose,Volume,Amount,Change,ChangePercentage,ContinueTrend,TurnoverRate,CreatedOn,ModifiedOn")] StockPerf stockPerf) { if (id != stockPerf.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(stockPerf); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StockPerfExists(stockPerf.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(stockPerf)); }
public async Task <IActionResult> Edit(string id, [Bind("Id,Name,StartDate,BenchmarkId,Description,CreatedOn,ModifiedOn")] Strategy strategy) { if (id != strategy.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(strategy); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StrategyExists(strategy.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(strategy)); }
public async Task <IActionResult> Edit(string id, [Bind("Id,StrategyId,StockId,TXDate,TXPrice,Shares,Amount")] Statement statement) { if (id != statement.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(statement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StatementExists(statement.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StrategyId"] = new SelectList(_context.Strategys, "Id", "Id", statement.StrategyId); return(View(statement)); }
public async Task <IActionResult> Edit(string id, [Bind("Id,Name,BriefName,Symbol,Market,Price,Date,Status,Type")] StockInfo stockInfo) { if (id != stockInfo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { StockInfo exist = await _context.StockInfos.FindAsync(stockInfo.Id); exist.Name = stockInfo.Name; exist.BriefName = stockInfo.BriefName; exist.Symbol = stockInfo.Symbol; exist.Market = stockInfo.Market; exist.Price = stockInfo.Price; exist.Date = stockInfo.Date; exist.Status = stockInfo.Status; exist.Type = stockInfo.Type; exist.ModifiedOn = DateTime.Now; _context.Update(exist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StockInfoExists(stockInfo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(stockInfo)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Date,Name,BaseAmount,Benchmark,Status")] MasterPortfolio masterPortfolio) { if (id != masterPortfolio.Id) { return(NotFound()); } if (ModelState.IsValid) { try { MasterPortfolio exist = _context.MasterPortfolios.Find(masterPortfolio.Id); exist.Name = masterPortfolio.Name; exist.Date = masterPortfolio.Date; exist.BaseAmount = masterPortfolio.BaseAmount; exist.Benchmark = masterPortfolio.Benchmark; exist.Status = masterPortfolio.Status; exist.ModifiedOn = DateTime.Now; _context.Update(exist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MasterPortfolioExists(masterPortfolio.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(masterPortfolio)); }