Exemple #1
0
        public void Delete()
        {
            //Arrange
            var explorationId = _dataContext.CnsExplorations.First().Id;

            //Act
            _cnsExplorationService.Delete(explorationId);
            var exploration = _dataContext.CnsExplorations.FirstOrDefault(e => e.Id == explorationId);

            //Assert
            Assert.That(exploration, Is.Null);
        }
        /// <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);
        }