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