public async Task <IActionResult> Partial(string appointment_id, int?id, string profile_id) { var progress_note = new mp_progress_note(); //get progress not with the appointment_id if (id.HasValue) { progress_note = await _progressNoteService.GetProgressNote(id.Value); return(View(progress_note)); } else { progress_note = (await _progressNoteService.GetProgressNotes()).FirstOrDefault(e => e.appointment_id == Guid.Parse(appointment_id)); if (progress_note == null) { progress_note = new mp_progress_note { appointment_id = Guid.Parse(appointment_id) }; } ViewBag.appointment_id = Guid.Parse(appointment_id); ViewBag.profile_id = Guid.Parse(profile_id); } return(PartialView(progress_note)); }
public IActionResult Edit(long id, [Bind("id,profile_id,appetite,sleep,side_effects,meditation_efficacy,medication_compliance,orientation,rapport,appearance,mood,affect,speech,thought_process,insight,judgement,cognitive,psychomotor_activity,memory,assessment,assessment_descriptioni,plan")] mp_progress_note mp_progress_note) { if (id != mp_progress_note.id) { return(NotFound()); } if (ModelState.IsValid) { try { _progressNoteService.UpdateProgressNote(mp_progress_note); } catch (DbUpdateConcurrencyException) { if (!_progressNoteService.ProgressNoteExists(mp_progress_note.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } //ViewData["profile_id"] = new SelectList(_context.mp_profile, "id", "first_name", mp_progress_note.profile_id); return(View(mp_progress_note)); }
public IActionResult GetProgressNote(Guid appointment_id) { var progress_note = _progressNoteService.Get().FirstOrDefault(e => e.appointment_id == appointment_id); if (progress_note == null) { progress_note = new mp_progress_note { appointment_id = appointment_id }; } return(Ok(progress_note)); }
public int UpdateProgressNote(mp_progress_note note) { var existing = _context.mp_progress_note.FirstOrDefault(m => m.id == note.id); if (existing != null) { //do update note.created_at = existing.created_at; note.created_by = existing.created_by; _context.Entry(existing).CurrentValues.SetValues(note); return(_context.SaveChanges()); } return(0); }
public async Task <IActionResult> Create([Bind("profile_id,appetite,sleep,side_effects,meditation_efficacy,medication_compliance,orientation,rapport,appearance,mood,affect,speech,thought_process,insight,judgement,cognitive,psychomotor_activity,memory,assessment,assessment_descriptioni,plan,appointment_id")] mp_progress_note mp_progress_note) { var appointment = _appointmentService.Get(mp_progress_note.appointment_id); mp_progress_note.profile_id = appointment.client_id; mp_progress_note.created_by = _userManager.GetUserId(HttpContext.User); if (ModelState.IsValid) { await _progressNoteService.AddProgressNote(mp_progress_note); return(RedirectToAction(nameof(Index))); } //ViewData["profile_id"] = new SelectList(_context.mp_profile, "id", "first_name", mp_progress_note.profile_id); return(View(mp_progress_note)); }
public async Task <IActionResult> PostProgressNote(mp_progress_note note) { var old = _progressNoteService.Get().FirstOrDefault(e => e.appointment_id == note.appointment_id); var email = _userManager.GetUserId(HttpContext.User); var user = await _userManager.FindByEmailAsync(email); if (old == null) { //this is a new form note.created_by = user.Id; await _progressNoteService.AddProgressNote(note); } else { //update the existing form note.created_by = old.created_by; note.id = old.id; _progressNoteService.UpdateProgressNote(note); } return(Ok(200)); }
public async Task <int> AddProgressNote(mp_progress_note note) { _context.Add(note); return(await _context.SaveChangesAsync()); }