Example #1
0
        public async Task <IActionResult> DeleteUser(string id)
        {
            var isPatient = await _adminService.IsPatient(id);

            var isDoctor = await _adminService.IsDoctor(id);

            var result = await _adminService.DeleteUser(id);

            if (result.Succeeded)
            {
                if (isPatient)
                {
                    await _patientService.DeletePatient(id);
                }
                if (isDoctor)
                {
                    await _doctorService.DeleteDoctor(id);
                }

                return(RedirectToAction("Index"));
            }

            foreach (var err in result.Errors)
            {
                ModelState.AddModelError("", err);
            }

            return(View("Index"));
        }
Example #2
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var oldDoctor = await _doctorService.GetDoctorByIdAsync(id);

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

                if (await _doctorService.DeleteDoctor(oldDoctor))
                {
                    return(Ok());
                }
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e}"));
            }

            return(BadRequest("Failed to delete the room"));
        }
 public bool DeleteProfile(string jmbg)
 {
     return(doctorSevice.DeleteDoctor(jmbg));
 }
 public async Task <OutputBase> DeleteDoctor(long hospitalId, string dialysisDoctorId)
 {
     return(await _doctorService.DeleteDoctor(hospitalId, dialysisDoctorId));
 }