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> Create([Bind("SiteId,ContractId,ScheduledDateTime,EstimatedDurationMins,ActualDurationMins,EstimatedAppliances,ActualAppliances,TestSlowResult,Id,Created,Modified")] TestSlot testSlot) { if (ModelState.IsValid) { testSlot.Id = Guid.NewGuid(); _context.Add(testSlot); await _context.SaveChangesAsync(); 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)); }