public async Task <IActionResult> Edit(int id, [Bind("AmazonPurchaseId,Quantity,Description,PurchasePrice,URL,ShippingCost")] AmazonPurchase amazonPurchase) { if (id != amazonPurchase.AmazonPurchaseId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(amazonPurchase); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AmazonPurchaseExists(amazonPurchase.AmazonPurchaseId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(amazonPurchase)); }
public async Task <IActionResult> Create([Bind("AmazonPurchaseId,Quantity,Description,PurchasePrice,URL,ShippingCost")] AmazonPurchase amazonPurchase) { if (ModelState.IsValid) { _context.Add(amazonPurchase); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(amazonPurchase)); }