public async Task <IActionResult> Edit(int id, [Bind("Id,Heading,DealInfo,CompanyId,Date")] Deal deal) { if (id != deal.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(deal); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DealExists(deal.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompanyId"] = new SelectList(_context.Company, "Id", "Id", deal.CompanyId); return(View(deal)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email")] Customer customer) { if (id != customer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyName,Email,ContactNumber")] 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)); }