public IActionResult AddAppointment([FromBody] Appointment appointment, string userName) { if (loggedInPatients.checkIfLoggedIn(userName)) { var addedAppointment = appointmentRepository.Add(appointment); return(Ok(addedAppointment)); } else { return(Ok()); } }
public IActionResult GetDoctorById(string userName, int doctorId) { if (loggedInAdmins.checkIfLoggedIn(userName) || loggedInPatients.checkIfLoggedIn(userName)) { var doctor = doctorRepository.GetByID(doctorId); //Console.WriteLine(doctor.name); return(Ok(doctor)); } else { return(Ok()); } }
public IActionResult Authenticate([FromBody] UserCred userCred) { if (patientRepository.GetByEmail(userCred.email) == null) { return(Ok()); } else { if (patientRepository.GetByEmail(userCred.email).password == userCred.password) { if (!loggedInPatients.checkIfLoggedIn(userCred.email)) { loggedInPatients.AddLoggedInPatients(userCred.email); } return(Ok(userCred)); } else { return(Ok()); } } }