public async Task <IActionResult> Edit(Guid id, Site site) { if (id != site.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(site); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SiteExists(site.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "CompanyName", site.CompanyId); return(View(site)); }
public async Task <IActionResult> Edit(Guid id, [Bind("SiteId,ContractId,ScheduledDateTime,EstimatedDurationMins,ActualDurationMins,EstimatedAppliances,ActualAppliances,TestSlowResult,Id,Created,Modified")] TestSlot testSlot) { if (id != testSlot.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(testSlot); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TestSlotExists(testSlot.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ContractId"] = new SelectList(_context.Contracts, "Id", "Id", testSlot.ContractId); ViewData["SiteId"] = new SelectList(_context.Sites, "Id", "Id", testSlot.SiteId); return(View(testSlot)); }
public async Task <IActionResult> Edit(Guid id, Contact contact) { if (id != contact.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(contact); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContactExists(contact.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Details", "Companies", new { id = contact.CompanyId })); } ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "CompanyName", contact.CompanyId); return(View(contact)); }
public async Task <IActionResult> Edit(Guid id, [Bind("IntervalMonths,CompanyId,SiteId,StartDate,RenewalDate,CancelledDate,Id,Created,Modified")] Contract contract) { if (id != contract.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(contract); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContractExists(contract.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "CompanyName", contract.CompanyId); ViewData["SiteId"] = new SelectList(_context.Sites, "Id", "Id", contract.SiteId); return(View(contract)); }
public async Task <IActionResult> Edit(Guid id, [Bind("CompanyName,Id,Created,Modified")] 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)); }