public async Task <IActionResult> Register([FromBody] PatientRegister patientRegister) { // Check unique Login if (await _patientRepo.PatientExists(patientRegister.Login)) { ModelState.AddModelError("Login", "Логин пользователя уже используется"); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var PatientToCreate = new Patient { Role = "patient", Login = patientRegister.Login, Name = patientRegister.Name.ToLower(), FamilyName = patientRegister.FamilyName.ToLower(), MiddleName = patientRegister.MiddleName.ToLower(), Birthdate = patientRegister.Birthdate }; var createPatient = await _patientRepo.RegisterPatient(PatientToCreate, patientRegister.Password); return(StatusCode(201)); }
//here we can register patient public bool PatientRegister(PatientRegister PR) { using (HMS_APIEntities hms = new HMS_APIEntities()) { hms.PatientRegisters.Add(PR); hms.SaveChanges(); } return(true); }
public bool Appoinment(PatientRegister SearchModel) { using (HMS_APIEntities hms = new HMS_APIEntities()) { // i put business logic in a (PatientRegister.cs) for sorting by Id,Name,Phone var business = new ProductBusinessLogic(); var model = business.PatientRegister(SearchModel); } return(true); }
// here we can delet patient record public bool DeletePatient(PatientRegister PR) { using (HMS_APIEntities hms = new HMS_APIEntities()) { PatientRegister DeletePatient = (from c in hms.PatientRegisters where c.PatientId == PR.PatientId select c).FirstOrDefault(); hms.PatientRegisters.Remove(DeletePatient); hms.SaveChanges(); } return(true); }
// here we can update patient what i register in above method public bool UpdatePatient(PatientRegister PR) { using (HMS_APIEntities hms = new HMS_APIEntities()) { PatientRegister UpdatedPatient = (from p in hms.PatientRegisters where p.PatientId == PR.PatientId select p).FirstOrDefault(); UpdatedPatient.Name = PR.Name; UpdatedPatient.Phone = PR.Phone; UpdatedPatient.CNIC = PR.CNIC; hms.SaveChanges(); } return(true); }
public bool Pannel(PatientRegister PR) { return(true); }