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); }
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()); } }
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")); }
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")); }
public ActionResult Delete(int id) { if (pth.DeletePatient(id)) { ViewBag.Message = "Patiient Successfully Deleted"; return(RedirectToAction("Index")); } else { return(View()); } }
public ActionResult Delete(int id, Patient patient) { try { PatientService.DeletePatient(id); return(RedirectToAction("Index")); } catch { return(View()); } }
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)); }
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); }
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")); }
// DELETE api/values/5 public void Delete(int id) { _service.DeletePatient(id); }
public bool DeletePatient(int patientId) { return(_patientService.DeletePatient(patientId)); }
public bool DeleteProfile(string jmbg) { return(patientService.DeletePatient(jmbg)); }