public async Task <IActionResult> Edit(int id, [Bind("Id,Text,SamuraiId")] Quote quote) { if (id != quote.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(quote); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!QuoteExists(quote.Id)) { return(NotFound()); } else { throw; } } //return RedirectToAction(nameof(Index)); return(RedirectToAction("Details", "Samurais", new { id = quote.SamuraiId })); } //ViewData["SamuraiId"] = new SelectList(_context.Samurais, "Id", "Id", quote.SamuraiId); //return View(quote); return(RedirectToAction("Details", "Samurais", new { id = quote.SamuraiId })); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,CustomerName,BirthDate,Gender,IsActive,CreatedDate,UpdatedDate")] Customer customer) { if (id != customer.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
//public async Task<IActionResult> Edit(int id, [Bind("Id,Name")] Samurai samurai) public async Task <IActionResult> Edit(int id, Samurai samurai) { if (id != samurai.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(samurai); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SamuraiExists(samurai.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(samurai)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderId,ProductId,Quantity,Rate")] OrderDetail orderDetail) { if (id != orderDetail.OrderId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(orderDetail); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderDetailExists(orderDetail.OrderId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["OrderId"] = new SelectList(_context.Order, "OrderId", "OrderId", orderDetail.OrderId); ViewData["ProductId"] = new SelectList(_context.Product, "ProductId", "ProductName", orderDetail.ProductId); return(View(orderDetail)); }
public async Task <IActionResult> Edit(int id, [Bind("CategoryId,CategoryName")] Category category) { if (id != category.CategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("ProductId,ProductName,Rate,Quantity,CategoryId")] Product product) { if (id != product.ProductId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.ProductId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryName", product.CategoryId); return(View(product)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderId,OrderDate,CustomerId,TotalAmount")] Order order) { if (id != order.OrderId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.OrderId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "CustomerId", "CustomerName", order.CustomerId); return(View(order)); }