public async Task <IActionResult> Edit(int id, [Bind("TradeID,TradeType")] Trade trade) { if (id != trade.TradeID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(trade); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TradeExists(trade.TradeID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(trade)); }
public async Task <IActionResult> Edit(int id, [Bind("ContractorID,FirstName,LastName,Email,BusinessName,PhoneNumber,TradeID,City,ReviewCount,AverageRating")] Contractor contractor) { if (id != contractor.ContractorID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(contractor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContractorExists(contractor.ContractorID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["TradeID"] = new SelectList(_context.Trades, "TradeID", "TradeID", contractor.TradeID); return(View(contractor)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerID,FirstName,LastName,PhoneNumber,Email,City")] 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("Index")); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("ReviewID,ContractorID,CustomerID,Rating,message")] Review review) { if (id != review.ReviewID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(review); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReviewExists(review.ReviewID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["ContractorID"] = new SelectList(_context.Contractors, "ContractorID", "BusinessName", review.ContractorID); ViewData["CustomerID"] = new SelectList(_context.Customers, "CustomerID", "City", review.CustomerID); return(View(review)); }