Example #1
0
        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));
        }
Example #2
0
 //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);
 }
Example #3
0
 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);
 }
Example #4
0
 // 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);
 }
Example #5
0
 // 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);
 }
Example #6
0
 public bool Pannel(PatientRegister PR)
 {
     return(true);
 }