public IActionResult Delete(PortfolioAccount portfolioAccount) { PortfolioAccount portfolio = _connectDb.PortfolioAccounts.Where(a => a.Id == portfolioAccount.Id).FirstOrDefault(); if (portfolio != null) { _connectDb.Remove(portfolio); _connectDb.SaveChanges(); } return(RedirectToAction("Index")); }
public IActionResult Delete(Stock stock) { Stock stockId = _connectDb.Stocks.Where(a => a.Id == stock.Id).FirstOrDefault(); if (stockId != null) { _connectDb.Remove(stockId); _connectDb.SaveChanges(); } return(RedirectToAction("Index")); }