public static FireSafetyControlMeasureDto Map(FireSafetyControlMeasure entity)
 {
     return new FireSafetyControlMeasureDto()
                {
                    Id = entity.Id,
                    Name = entity.Name
                };
 }
Exemplo n.º 2
0
        private void DetachFireSafetyControlMeasureFromRiskAssessment(FireSafetyControlMeasure fireSafetyControlMeasure, UserForAuditing user)
        {
            if (FireSafetyControlMeasures.Count(x => x.FireSafetyControlMeasure == fireSafetyControlMeasure) == 0)
            {
                throw new FireSafetyControlMeasureNotAttachedToRiskAssessmentException(Id, fireSafetyControlMeasure.Id);
            }
            var fireRiskAssessmentControlMeasure =
                FireSafetyControlMeasures.Single(x => x.FireSafetyControlMeasure == fireSafetyControlMeasure);

            fireRiskAssessmentControlMeasure.MarkForDelete(user);
            SetLastModifiedDetails(user);
        }
Exemplo n.º 3
0
        private void AttachFireSafetyControlMeasureToRiskAssessment(FireSafetyControlMeasure fireSafetyControlMeasure, UserForAuditing user)
        {
            if (!FireSafetyControlMeasures.Any(x => x.FireSafetyControlMeasure.Id == fireSafetyControlMeasure.Id))
            {
                FireSafetyControlMeasures.Add(new FireRiskAssessmentControlMeasure
                {
                    FireSafetyControlMeasure = fireSafetyControlMeasure,
                    RiskAssessment = this,
                    CreatedBy = user,
                    CreatedOn = DateTime.Now,
                    Deleted = false
                });

                SetLastModifiedDetails(user);
            }

        }
Exemplo n.º 4
0
 private bool FireSafetyControlMeasureNotAttachedToRiskAssessment(FireSafetyControlMeasure fireSafetyControlMeasure)
 {
     return FireSafetyControlMeasures.Count(x => x.FireSafetyControlMeasure == fireSafetyControlMeasure) == 0;
 }