private async Task SetUp(string peerCoachId, string patientId) { await SetUp(); var peerCoach = new PeerCoach(_pulseContext, peerCoachId); var patient = new Patient(patientId, _pulseContext); _model.Patient = peerCoach.AssignedPatients.Where(a => a.Id == patientId).FirstOrDefault(); _model.PeerCoach = patient.AssignedPeerCoach; _model.MessageHistory = patient.MessageHistory; _model.Sender = _user; _model.Receiver = _model.Patient; }
public async Task <IActionResult> Index() { await SetUp(); if (_isPatient) { SetUpPatient(); } else if (_isPeerCoach) { var peerCoach = new PeerCoach(_pulseContext, _user.Id); _coachIndex.AssignedPatients = peerCoach.AssignedPatients; _coachIndex.PeerCoach = _user; return(View("Views/Chat/CoachIndex.cshtml", _coachIndex)); } else { SetUpAdmin(); return(View("Views/Chat/AdminIndex.cshtml", _adminIndex)); } return(View("Views/Chat/Chat.cshtml", _model)); }