Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Doctor doctor = _doctorRepository.GetDoctorById(id);

            _doctorRepository.DeleteDoctor(id);
            _doctorRepository.Save();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public async Task DeleteDoctor(Guid id)
        {
            var doctor = await _doctorRepository.GetById(id);

            doctor.ifUserNotExists("Db doesn't contain this doctor");

            await _doctorRepository.DeleteDoctor(doctor);
        }
        public DeleteDoctorDTO DeleteDoctor(int id, [FromBody] DeleteDoctorDTO doctor)
        {
            Doctor doctorEntity = _repository.GetDoctorById(id);

            doctor.Id = doctorEntity.Id;
            _mapper.Map(doctor, doctorEntity);
            _repository.DeleteDoctor(doctorEntity);
            _repository.Save();
            return(doctor);
        }
        public IActionResult Delete(int DoctorID)
        {
            Doctor deletedDoctor = repository.DeleteDoctor(DoctorID);

            if (deletedDoctor != null)
            {
                TempData["message"] = $"Deleted succesfully {deletedDoctor.LastName}.";
            }
            return(RedirectToAction(nameof(Index)));
        }
        public IActionResult DeleteDoctor(int doctorId)
        {
            var doctorFromRepo = _doctorRepository.GetDoctor(doctorId);

            if (doctorFromRepo == null)
            {
                return(NotFound());
            }
            _doctorRepository.DeleteDoctor(doctorFromRepo);
            return(NoContent());
        }
Exemple #6
0
 public DateTime DismissDoctor(int doctorId, DateTime dateOfDismissal)
 {
     lock (_locker.GetOrAdd(doctorId))
     {
         if (HasConflictSession(doctorId, dateOfDismissal))
         {
             throw new WarningException(ExceptionMessages.HasConflictSessions);
         }
         return(_doctorRepository.DeleteDoctor(doctorId, dateOfDismissal));
     }
 }
        public IActionResult DeleteDoctor(int id)
        {
            if (id == 0)
                return BadRequest();

            var doctorToDelete = _doctorRepository.GetDoctorById(id);
            if (doctorToDelete == null)
                return NotFound();

            _doctorRepository.DeleteDoctor(id);

            return NoContent();
        }
        public IActionResult Delete(int doctorId)
        {
            var P = _service.GetPatientsByDoctor(doctorId);
            var T = _service.GetDoctorTimeTable(doctorId);

            if (P != 0 || T != 0)
            {
                return(BadRequest());
            }

            _service.DeleteDoctor(doctorId);

            return(RedirectToAction("Index"));
        }
        public async Task DeleteDoctorAsync(int id)
        {
            if (id <= 0)
            {
                throw new ArgumentException(nameof(id), "Doctor's id <= 0");
            }

            var doctor = await _doctorRepository.GetDoctorByIdAsync(id);

            if (doctor == null)
            {
                throw new NotFoundException($"Doctor with id = {id} isn't found");
            }

            _doctorRepository.DeleteDoctor(doctor);
            await _doctorRepository.SaveAsync();
        }
        public async Task <IActionResult> DeleteDoctor([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var doctor = await repository.getDoctorAsync(id);

            if (doctor == null)
            {
                return(NotFound());
            }

            repository.DeleteDoctor(doctor);
            await unitOfWork.CompleteAsync();

            return(Ok(id));
        }
Exemple #11
0
        public IActionResult DeleteDoctor(Guid id)
        {
            if (!_doctor.DoctorExists(id))
            {
                return(NotFound());
            }

            var doctorsDto = _doctor.GetDoctor(id);

            if (_patient.PatientExistsByDoctor(id))
            {
                ModelState.AddModelError("", "This Doctor have One or more Patients");
                return(StatusCode(404, ModelState));
            }

            if (!_doctor.DeleteDoctor(doctorsDto))
            {
                ModelState.AddModelError("", $"Something went wrong when you trying to deleting {doctorsDto.Name}");
                return(StatusCode(500, ModelState));
            }

            return(NoContent());
        }
 public void DeleteDoctor(int doctorId)
 {
     _doctorRepository.DeleteDoctor(doctorId);
 }
Exemple #13
0
        public async Task <ActionResult> DeleteDoctor(int id)
        {
            var deleted = await _repo.DeleteDoctor(id);

            return(Ok(deleted));
        }
Exemple #14
0
 public async Task DeleteDoctor(int id)
 {
     await doctorRepository.DeleteDoctor(id);
 }
        public IActionResult Delete(int id)
        {
            var result = _docrepo.DeleteDoctor(id);

            return(RedirectToAction("ListDoctors"));
        }
Exemple #16
0
 public async Task Delete(Doctor doctor)
 {
     _doctorRepo.DeleteDoctor(doctor);
     await _doctorRepo.Save();
 }