public IActionResult UpdateProfile([FromBody] DoctorsModel obj) { var doc = _doctorRepository.GetDoctorByUserName(obj.UserName); if (doc is null) { return(StatusCode(500)); } else { doc.NameTitle = obj.NameTitle; doc.DoctorName = obj.DoctorName; doc.Email = obj.Email; doc.MobileNumber = obj.MobileNumber; doc.Designation = obj.Designation; doc.MedicalDegree = obj.MedicalDegree; doc.Clinic = obj.Clinic; //doc.Password = Cipher.Decrypt(doc.Password, doc.UserName); if (obj.Image != null) { doc.Image = obj.Image; } } FewaDbContext.DoctorsModels.Update(doc); FewaDbContext.SaveChanges(); return(Ok(doc)); }
public IActionResult PatientAttended([FromBody] Patient obj) { Patient p = GetPatientbyName(obj.name); if (p is null) { return(StatusCode(500)); } else { GetCurrentProviderCabin().patient = new Patient(); p.status = (int)TeleConstants.PatientCompleted; p.labOrdersSent = obj.labOrdersSent; p.newPrescriptionsSentToYourPharmacy = obj.newPrescriptionsSentToYourPharmacy; p.newPrescriptionsMailedToYou = obj.newPrescriptionsMailedToYou; p.medication = obj.medication; p.followUpNumber = obj.followUpNumber; p.followUpMeasure = obj.followUpMeasure; p.endTime = DateTime.Now; p.medication = obj.medication; p.followUpNumber = obj.followUpNumber; p.followUpMeasure = obj.followUpMeasure; p.url = obj.url; p.advice = obj.advice; p.practice = obj.practice; FewaDbContext.patients.Add(p); FewaDbContext.SaveChanges(); return(Ok(p)); } }
public ActionResult ResetPassword([FromBody] Provider obj) { try { if (obj == null) { return(BadRequest()); } if (string.IsNullOrEmpty(obj.email) && (string.IsNullOrEmpty(obj.email) || string.IsNullOrEmpty(obj.userName))) { return(BadRequest()); } Provider provider = FewaDbContext.providers.Where(a => (a.email == obj.email || a.userName == obj.email) && a.practice.ToLower().Trim() == obj.practice.ToLower().Trim()).FirstOrDefault(); if (provider == null) { return(Unauthorized(new { Message = "provider not found" })); } provider.password = Cipher.Encrypt(obj.newPassword, provider.userName); FewaDbContext.providers.Update(provider); FewaDbContext.SaveChanges(); return(Ok(new { Message = "password has been changed successfully" })); } catch (Exception ex) { return(StatusCode(500, ex)); } }
public ActionResult Login(DoctorsModel doctor) { try { if (doctor == null) { return(BadRequest()); } if (string.IsNullOrEmpty(doctor.UserName)) { return(BadRequest()); } var doc = _doctorRepository.GetDoctorByUserName(doctor.UserName); /*if(doc.DoctorRoomName == null) * doc.DoctorRoomName = "Fewa" + doc.UserName;*/ doc.DoctorRoomName = doc.DoctorRoomName.Replace("DoctorName", doctor.UserName); FewaDbContext.DoctorsModels.Update(doc); FewaDbContext.SaveChanges(); if (doc == null) { return(Unauthorized()); } var docPwd = Cipher.Decrypt(doc.Password, doctor.UserName); if (doctor.Password != docPwd) { return(Unauthorized()); } if (docPwd == doctor.Password) { doctor.Image = doc.Image; doctor.NameTitle = doc.NameTitle; doctor.DoctorName = doc.DoctorName; doctor.DoctorRoomName = doc.DoctorRoomName; HttpContext.Session.SetString("Name", doctor.UserName); var token = GenerateJSONWebToken(doctor.UserName, "doctor"); AddDoctorCabin(doc.UserName); var data = new { User = doctor, Token = token }; return(Ok(data)); } return(Unauthorized()); } catch (Exception ex) { return(StatusCode(500, ex)); } }
public async Task PatientAttended(PatientsAttendedModel obj) { try { PatientsAttendedModel p = getPatientbyName(obj.PatientName); if (p is null) { return; } else { getCurrentDoctorCabin().PatientsAttendedModel = new PatientsAttendedModel(); p.Status = (int)TeleConstants.PatientCompleted; p.LabOrdersSent = obj.LabOrdersSent; p.NewPrescriptionsSentToYourPharmacy = obj.NewPrescriptionsSentToYourPharmacy; p.NewPrescriptionsMailedToYou = obj.NewPrescriptionsMailedToYou; p.EndTime = DateTime.Now; p.Medication = obj.Medication; p.FollowUpNumber = obj.FollowUpNumber; p.FollowUpMeasure = obj.FollowUpMeasure; var patient = JsonConvert.SerializeObject(p); await this.Clients.Clients(getPatientbyName(obj.PatientName).SignalRConnectionId) .CompletePatient(patient); waitingroom.Patients.Remove(p); SendUpdatedPatients(); fewaDbContext.PatientsAttendedModels.Add(p); fewaDbContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public PatientsAttendedModel AddNewPatient(PatientsAttendedModel patient) { _context.PatientsAttendedModels.Add(patient); _context.SaveChanges(); return(patient); }
public Patient AddNewPatient(Patient patient) { _context.patients.Add(patient); _context.SaveChanges(); return(patient); }