public Doctor RegisterDoctor(Doctor doctor) { if (!IsUsernameValid(doctor.Username) || !IsPasswordValid(doctor.Password)) { throw new ValidationException("Your username or password is incorrect. Please try again."); } _doctorRepository.AddDoctor(doctor); return(doctor); }
public IActionResult CreateDoctor([FromBody] Doctor doctor) { if (doctor == null) return BadRequest(); if (!ModelState.IsValid) return BadRequest(ModelState); var createdDoctor = _doctorRepository.AddDoctor(doctor); return Created("doctor", createdDoctor); }
public ActionResult Create([Bind(Include = "Id,Firstname,Lastname,Pesel")] Doctor doctor) { if (ModelState.IsValid) { _doctorRepository.AddDoctor(doctor); _doctorRepository.Save(); return(RedirectToAction("Index")); } return(View(doctor)); }
public async Task <IActionResult> AddDoctor(DoctorForAddDto doctor) { if (ModelState.IsValid) { var addedDoctor = await _repo.AddDoctor(_mapper.Map <Doctor>(doctor)); return(Ok(addedDoctor)); } else { return(BadRequest()); } }
public void AddDoctor(Doctor doc) { Doctor d = repository.GetDoctorById(doc.userid); if (d == null) { repository.AddDoctor(doc); } else { throw new DoctorAlreadyExistsException($"Doctor with doctorId {doc.userid} already Exists"); } }
private void AddDoctorBtn_Click(object sender, EventArgs e) { if (people != null) { if (!checkRepository.IsExistDoctor(people.CodeMelli, ClinicId)) { if (list.Count > 0) { Doctor doctor = new Doctor() { PeopleId = people.Id, ClinicId = this.ClinicId, }; doctorRepository.AddDoctor(doctor); foreach (var item in list) { TurnTypeDoctor turnTypeDoctor = new TurnTypeDoctor() { DoctorId = doctor.Id, TurnTypeId = item.Id }; turnTypeDoctorRepository.AddTurnTypeDoctor(turnTypeDoctor); } var result = MessageBox.Show("عملیات با موفقیت انجام شد", "موفق", MessageBoxButtons.OK); if (result == DialogResult.OK) { this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("ابتدا یک تخصص اضافه نمایید !", "خطا", MessageBoxButtons.OK); } } else { MessageBox.Show("پزشک مورد نظر قبلا در سیستم ثبت شده است !", "خطا", MessageBoxButtons.OK); } } else { MessageBox.Show("لطفا ابتدا یک کدملی معتبر را وارد نموده و بر روی کلید بررسی کد ملی کلیک نمایید !", "خطا", MessageBoxButtons.OK); } }
public async Task AddDoctor(string email, string password, string pesel, string firstName, string secondName, string phoneNumber, string postCode, string city, string street, string houseNumber) { var user = await _userRepository.GetByEmail(email); user.ifUserExists("This email is existed in db"); user = await _userRepository.GetByPesel(pesel); user.ifUserExists("This pesel is existed in db"); var doctor = new Doctor(new Guid(), email, "doctor", DateTime.UtcNow, firstName, secondName, pesel, phoneNumber, postCode, city, street, houseNumber); await _doctorRepository.AddDoctor(doctor); }
public ActionResult Create(UserViewModel viewModel) { UserRole role = viewModel.GetRole(); int id; if (role == UserRole.Doctor) { Doctor doctor = viewModel.GetDoctor(); _doctorRepository.AddDoctor(doctor); id = doctor.DoctorId; _accountManagementService.CreateAccountForDoctor(id); } else { Staff staff = viewModel.GetStaff(); _staffRepository.AddStaff(staff); id = staff.StaffId; _accountManagementService.CreateAccountForStaff(id, role); } return(RedirectToAction("Details", new { id, role, showUserCreatedAlert = true })); }
public async Task <Doctor> AddDoctor(Doctor doctor) { return(await doctorRepository.AddDoctor(doctor)); }
public async Task <IActionResult> Post([FromBody] Doctor doctor) { await _doctorRepository.AddDoctor(doctor); return(new OkObjectResult(doctor)); }