public async Task<IActionResult> Edit( string UserName, PatientViewModel patientVM ) { if ( ModelState.IsValid ) { var editedPat = await patientVM.GetNewPatient( _doc ); //editedPat.Doctor = await _doc.ReadAsync( patientVM.DoctorUserName ); //editedPat.DoctorUserName = patientVM.DoctorUserName; await _pat.UpdateAsync( patientVM.UserName, editedPat ); if ( User.IsInRole( Roles.DEVELOPER ) ) return RedirectToAction( nameof( PatientList ) ); else if( User.IsInRole( Roles.PATIENT ) ) return RedirectToAction( nameof( Index ) ); else if ( User.IsInRole( Roles.DOCTOR ) ) return RedirectToAction( nameof( Index ), Roles.DOCTOR ); } return View( patientVM ); } // Create