public IActionResult Create(PortfolioAccount portfolio) { if (ModelState.IsValid) { _connectDb.Add(portfolio); _connectDb.SaveChanges(); } return(RedirectToAction("Index")); }
public IActionResult Create(Stock stock) { if (ModelState.IsValid) { _connectDb.Add(stock); _connectDb.SaveChanges(); } return(RedirectToAction("Index")); }
public IActionResult Create(StockReceiveMastViewModel stockReceiveMastViewModel) { if (ModelState.IsValid) { StockReceiveMast mast = new StockReceiveMast { EntryDate = DateTime.Now, EntryUserId = 2, PortfolioAcId = stockReceiveMastViewModel.PortfolioAcId, Remarks = stockReceiveMastViewModel.Remarks, ValueDate = DateTime.Now, Detail = stockReceiveMastViewModel.details.Select(a => new StockReceiveDetl { OwnershipDate = a.OwnerShipDate, Quantity = a.Quantity, Rate = a.Rate, StockId = a.StockId }).ToList() }; _connectDb.Add(mast); _connectDb.SaveChanges(); } return(RedirectToAction("Index")); }