// GET: Doctor/Delete/5 public ActionResult Delete(int id) { DoctorsModel model = new DoctorsModel(); model.delete(id); return(RedirectToAction("Doctors")); }
// GET: Doctor/Edit/5 public ActionResult Edit(int id) { DoctorsModel model = new DoctorsModel(); var Doctor = model.GetDoctors().First(m => m.Id == id); return(View(Doctor)); }
public ActionResult Doctors() { DoctorsModel model = new DoctorsModel(); var Doctors = model.GetDoctors(); return(View(Doctors)); }
public ActionResult Get(string MobileNumber) { try { var doctor = new DoctorsModel(); var doc = _doctorRepository.GetDoctorByUserName(doctor.UserName); if (doc != null) { return(StatusCode(500, new { DoctorsModel = doc, Message = "this mobile number is already registered" })); } //pat.LastUpdated = DateTime.Now; doctor.Otp = GenerateOtp(MobileNumber); doctor.MobileNumber = MobileNumber; //if (_waitingroom.Patients != null) //{ // if (_waitingroom.Patients.Count > 0) // { // pat.PatientId = _waitingroom.Patients.Count; // } //} return(Ok(doctor)); } catch (Exception ex) { return(StatusCode(500, ex)); } }
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 IHttpActionResult GetDoctor(int doctor_Id) { try { using (MaxMasterDbEntities db = new MaxMasterDbEntities()) { var docDetails = db.Doctors.Where(x => x.Id == doctor_Id).FirstOrDefault(); var specialities = docDetails.Specialties.Select(x => new { value = x.Id, label = x.Name }).OrderBy(x => x.label).ToList();; var doctor = new DoctorsModel(); if (doctor != null) { doctor.Salutation = docDetails.Salutation; doctor.FirstName = docDetails.FirstName; doctor.MiddleName = docDetails.MiddleName; doctor.LastName = docDetails.LastName; doctor.PhoneNumber = docDetails.PrimaryPhone; doctor.SecondaryNumber = docDetails.SecondaryPhone; doctor.Email = docDetails.Email; doctor.Client_Id = docDetails.Client_Id; doctor.Client = docDetails.Client.Name; doctor.Addressline1 = docDetails.AddressLine1; doctor.AddressLine2 = docDetails.AddressLine2; if (docDetails.City_Id != 0) { doctor.City_Id = docDetails.City_Id; doctor.City = docDetails.City.Name; doctor.State_Id = docDetails.City.State_Id; doctor.State = docDetails.City.State.Name; doctor.Country_Id = docDetails.City.State.Country_Id; doctor.Country = docDetails.City.State.Country.Name; } doctor.Zip = docDetails.ZIP; doctor.DictationMode = docDetails.DictationMode; doctor.JobLevel = docDetails.JobLevel; doctor.MacroPercent = docDetails.MacroPercent; doctor.IdigitalId = docDetails.IdigitalId; doctor.IdigitalAuthorId = docDetails.IdigitalAuthorId; doctor.DoctorGroup_Id = docDetails.DoctorGroup_Id; doctor.DoctorGroup = docDetails.DoctorGroup.Name; doctor.VoiceGrade = docDetails.VoiceGrade; doctor.IsActive = docDetails.Active; } return(Content(HttpStatusCode.OK, new { doctor, specialities })); } } catch (Exception ex) { new Error().logAPIError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString(), ex.StackTrace); return(Content(HttpStatusCode.InternalServerError, "An error occured, please try again later")); } }
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 ActionResult Edit(int id, FormCollection collection) { DoctorsModel model = new DoctorsModel(); try { model.Update(id, collection["FirstName"], collection["LastName"], collection["Phone"], collection["Email"], collection["LicenceNumber"], collection["Expertist"]); return(RedirectToAction("Doctors")); } catch { return(View()); } }
public ActionResult AddDoctor(FormCollection collection) { DoctorsModel model = new DoctorsModel(); try { string mailMessage = model.AddD(collection["FirstName"], collection["LastName"], collection["Phone"], collection["Email"], collection["LicenceNumber"], collection["Expertist"]); Response.Write("<script>alert(mailMessage);</script>"); return(RedirectToAction("Doctors")); } catch { return(View()); } }
public ActionResult SendInvitation([FromBody] DoctorCabin cabin) { try { DoctorsModel responseData = new DoctorsModel(); // string reqType = this.ReadQueryStringData("reqType"); //generate meeting id string meetingId = cabin.DoctorsModel.Id.ToString() + DateTime.Now.ToString("MMddHHmmss"); return(Ok(meetingId)); } catch (Exception) { throw; } }
public ActionResult Index(FormCollection collection) { DoctorsModel model = new DoctorsModel(); try { RouteConfig.user = model.ReturnUser(collection["uname"], collection["psw"]); if (RouteConfig.user == null) { Response.Write("<script>alert('The username or password you entered is incorrect');</script>"); } return(View()); } catch { return(View()); } }
public ActionResult VerifyOTP(DoctorsModel doctor) { // var p = _waitingroom.Patients.Find(a => a.MobileNumber == pat.MobileNumber); // var q = _waitingroom.Patients.Find(a => a.Email == pat.Email); var doc = _doctorRepository.GetDoctorByUserName(doctor.UserName); if (doc != null) { if (doc.Otp == doctor.Otp) { return(Ok(new { doctor = doc, Message = "otp verified" })); } else { return(Unauthorized(new { doctor = doc, Message = "invalid otp" })); } } else { return(Unauthorized(new { DoctorsModel = doc, Message = "user not found" })); } }
public async Task <bool> SendEmail([FromBody] DoctorsModel email) { string meetingId = email.Id.ToString() + DateTime.Now.ToString("MMddHHmmss"); email.MeetingId = meetingId; try { if (email is null) { return(false); } if (string.IsNullOrEmpty(email.Subject) || string.IsNullOrEmpty(email.Message) || string.IsNullOrEmpty(email.Email)) { return(false); } return(await _messengerService.SendEmailAsync(email.Subject, email.Message, email.Email)); } catch (Exception ex) { _logger.LogError($"file: MessengerController.cs method: SendEmail() error: {ex.Message} "); return(false); } }
// GET: Doctor public ActionResult Index() { DoctorsModel model = new DoctorsModel(); return(View(model.Doctors)); }