Ejemplo n.º 1
0
        public async Task DeletePatientDecrementsCount()
        {
            await _testService.DeletePatient(_testPatients[0].PatientId);

            var allPatients = await _testService.GetAllPatients();

            List <Patient> listOfPatients = (List <Patient>)allPatients;

            listOfPatients.Count.Should().Be(9);
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> DeletePatient(PatientModel patient)
        {
            if (patient == null)
            {
                return(BadRequest("Please provide valid inputs!"));
            }

            CommonResponse validatedResponse = await AuthService.ValidateUserAndToken();

            if (!validatedResponse.IsError)
            {
                if (await PatientService.PatientExists(patient))
                {
                    if (await PatientService.DeletePatient(patient))
                    {
                        return(Ok("Patient Deleted Successfully!"));
                    }
                    else
                    {
                        return(BadRequest("Failed to Delete Patient!"));
                    }
                }
                else
                {
                    return(BadRequest("No Such Patient Exisits!"));
                }
            }
            else
            {
                return(Unauthorized());
            }
        }
Ejemplo n.º 3
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"));
        }
Ejemplo n.º 4
0
 public bool DeletePatient(int id)
 {
     using (var context = new tech_assessmentContext())
     {
         return(service.DeletePatient(id, context));
     }
 }
        public ActionResult DeletePatient(int id)
        {
            var service = new PatientService();

            service.DeletePatient(id);
            TempData["SaveResult"] = "Patient deleted.";
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
 public ActionResult Delete(int id)
 {
     if (pth.DeletePatient(id))
     {
         ViewBag.Message = "Patiient Successfully Deleted";
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View());
     }
 }
Ejemplo n.º 7
0
        public ActionResult Delete(int id, Patient patient)
        {
            try
            {
                PatientService.DeletePatient(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 8
0
        public void DeletePatient_ItemDoesNotExists_NullReferenceException()
        {
            // Arrange
            var(unitOfWork, patientRepo, dbCollection) = GetMocks();
            var service = new PatientService(unitOfWork.Object);
            var patient = new Patient
            {
                Id       = 0,
                FullName = "Delete Name"
            };

            // Act + Assert
            Assert.ThrowsAsync <NullReferenceException>(async() => await service.DeletePatient(patient));
        }
Ejemplo n.º 9
0
        public async Task DeletePatient_TargetItem_Success()
        {
            // Arrange
            var(unitOfWork, patientRepo, dbCollection) = GetMocks();
            var service = new PatientService(unitOfWork.Object);
            var patient = new Patient
            {
                Id       = 26,
                FullName = "Delete Name"
            };

            // Act
            await service.DeletePatient(patient);

            // Assert
            Assert.IsFalse(dbCollection.ContainsKey(26));
        }
        public ActionResult <string> Delete(Guid patientId)
        {
            ActionResult retval = BadRequest(patientId);

            try
            {
                if (_patientService.DeletePatient(patientId))
                {
                    retval = new OkObjectResult(patientId);
                }
            }
            catch (Exception e)
            {
                Console.Write(e);
            }

            return(retval);
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var oldPatient = await _patientServices.GetPatientsByIdAsync(id);

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

                if (await _patientServices.DeletePatient(oldPatient))
                {
                    return(Ok());
                }
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e}"));
            }

            return(BadRequest("Failed to delete the room"));
        }
Ejemplo n.º 12
0
 // DELETE api/values/5
 public void Delete(int id)
 {
     _service.DeletePatient(id);
 }
Ejemplo n.º 13
0
 public bool DeletePatient(int patientId)
 {
     return(_patientService.DeletePatient(patientId));
 }
Ejemplo n.º 14
0
 public bool DeleteProfile(string jmbg)
 {
     return(patientService.DeletePatient(jmbg));
 }