public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyName,NumberOfTotalStocks,StocksSold,StockPrice")] Company company) { if (id != company.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(company); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyExists(company.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(company)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyId,StocksBuyerId,NumberOfStocks")] StocksPayment stocksPayment) { if (id != stocksPayment.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(stocksPayment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StocksPaymentExists(stocksPayment.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompanyId"] = new SelectList(_context.Company, "Id", "Id", stocksPayment.CompanyId); ViewData["StocksBuyerId"] = new SelectList(_context.StocksBuyer, "Id", "Id", stocksPayment.StocksBuyerId); return(View(stocksPayment)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,BuyerName,EmailAddress")] StocksBuyer stocksBuyer) { if (id != stocksBuyer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(stocksBuyer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StocksBuyerExists(stocksBuyer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(stocksBuyer)); }