public void Delete() { //Arrange var analysisId = _dataContext.Analyses.First().Id; //Act _analysisService.Delete(analysisId); var analysis = _dataContext.Analyses.FirstOrDefault(a => a.Id == analysisId); //Assert Assert.That(analysis, Is.Null); }
public async Task <IActionResult> Delete(int id) { if (id <= 0) { return(new BadRequestObjectResult(new Response("Invalid analysis id."))); } await _analysisService.Delete(id); var message = $"Analysis with id '{id}' deleted."; return(new OkObjectResult(new ApiResponse <int>(message, id))); }
/// <summary> /// Delete the NbrSurveillance with the given id. /// </summary> /// <param name="id">Id of the NbrSurveillance to delete.</param> /// <returns>bool indicating if the deletion was successful.</returns> public bool Delete(int id) { var surveillance = Repository.NbrSurveillances.SingleOrDefault(e => e.Id == id); if (surveillance == null) { return(false); } //Delete the surveillance var explorationId = surveillance.CnsExplorationId; var analysisId = surveillance.AnalysisId; Repository.NbrSurveillances.Remove(surveillance); Save(); //Delete related cns exploration _cnsExplorationService.Delete(explorationId); //Delete related analysis _analysisService.Delete(analysisId); return(true); }
/// <summary> /// Delete the Hypothermia with the given id. /// </summary> /// <param name="id">Id of the Hypothermia to delete.</param> /// <returns>bool indicating if the deletion was successful.</returns> public bool Delete(int id) { var hypothermia = Repository.Hypothermias.SingleOrDefault(e => e.Id == id); if (hypothermia == null) { return(false); } //Delete the hypothermia var explorationId = hypothermia.CnsExplorationId; var analysisId = hypothermia.AnalysisId; Repository.Hypothermias.Remove(hypothermia); Save(); //Delete related cns exploration _cnsExplorationService.Delete(explorationId); //Delete related analysis _analysisService.Delete(analysisId); return(true); }