コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,CompanyName,NumberOfTotalStocks,StocksSold,StockPrice")] Company company)
        {
            if (ModelState.IsValid)
            {
                _context.Add(company);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(company));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,BuyerName,EmailAddress")] StocksBuyer stocksBuyer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(stocksBuyer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(stocksBuyer));
        }