Exemplo n.º 1
0
        // GET: StockMultiplyers/Edit/5
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            StockMultiplyer stockMultiplyer = _context.StockMultiplyer.Include(s => s.Stock).Include(s => s.Fund).Single(m => m.ID == id);

            if (stockMultiplyer == null)
            {
                return(HttpNotFound());
            }

            IEnumerable <SelectListItem> funds = _context.Fund.Select(c => new SelectListItem
            {
                Value = c.ID.ToString(),
                Text  = c.Name
            });

            ViewBag.Funds = funds;

            IEnumerable <SelectListItem> stocks = _context.Stock.Select(c => new SelectListItem
            {
                Value = c.ID.ToString(),
                Text  = c.Name
            });

            ViewBag.Stocks = stocks;

            return(View(stockMultiplyer));
        }
Exemplo n.º 2
0
        public IActionResult DeleteConfirmed(int id)
        {
            StockMultiplyer stockMultiplyer = _context.StockMultiplyer.Single(m => m.ID == id);

            _context.StockMultiplyer.Remove(stockMultiplyer);
            _context.SaveChanges();
            return(RedirectToAction("Details", "Funds", new { id = stockMultiplyer.FundID }));
        }
Exemplo n.º 3
0
        public IActionResult Create(StockMultiplyer stockMultiplyer)
        {
            if (ModelState.IsValid)
            {
                _context.StockMultiplyer.Add(stockMultiplyer);
                _context.SaveChanges();
                return(RedirectToAction("Details", "Funds", new { id = stockMultiplyer.FundID }));
            }
            ViewData["FundID"]  = new SelectList(_context.Fund, "ID", "Fund", stockMultiplyer.FundID);
            ViewData["StockID"] = new SelectList(_context.Stock, "ID", "Stock", stockMultiplyer.StockID);

            return(View(stockMultiplyer));
        }
Exemplo n.º 4
0
        // GET: StockMultiplyers/Details/5
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            StockMultiplyer stockMultiplyer = _context.StockMultiplyer.Include(s => s.Stock).Include(s => s.Fund).Single(m => m.ID == id);

            if (stockMultiplyer == null)
            {
                return(HttpNotFound());
            }

            return(View(stockMultiplyer));
        }