public async Task <IActionResult> Edit(int id, [Bind("ApptId,ApptTitle,ApptDate,ApptLocation,ApptDuration,ApptNotes,UserId")] Appointment appointment) { if (id != appointment.ApptId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appointment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppointmentExists(appointment.ApptId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.User, "UserId", "UserName", appointment.UserId); return(View(appointment)); }
public async Task <IActionResult> Edit(int id, [Bind("DeadlineId,DeadlineTitle,DeadlineDate,DeadlineNotes,IsCompleted,UserId")] Deadline deadline) { if (id != deadline.DeadlineId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(deadline); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeadlineExists(deadline.DeadlineId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.User, "UserId", "UserName", deadline.UserId); return(View(deadline)); }
public async Task <IActionResult> Edit(int id, [Bind("UserId,UserName,IsParent")] User user) { if (id != user.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }