public async Task <IActionResult> Edit(long id, [Bind("Id,DeviceId,ServiceId,DateStarted,DateCompleted,Comments")] DeviceService deviceService) { if (id != deviceService.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(deviceService); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeviceServiceExists(deviceService.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["DeviceId"] = new SelectList(_context.Devices, "Id", "SerialNbr", deviceService.DeviceId); ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Title", deviceService.ServiceId); return(View(deviceService)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,UserId,SerialNbr,Type,Make,Model")] Device device) { if (id != device.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(device); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeviceExists(device.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Name", device.UserId); return(View(device)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,Title,Price,Description")] Service service) { if (id != service.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(service); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceExists(service.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(service)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Address,Phone,EmailAddress")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(user)); }