Exemplo n.º 1
0
        /// <summary>
        /// Validates before changing the data.
        /// </summary>
        /// <param name="changeAction"></param>
        /// <param name="changeTargets"></param>
        /// <param name="targets">Items that will be modified (Empty is target=AllItems)</param>
        /// <returns></returns>
        public IEnumerable <ChangeValidationResult> ValidateChange <T>(ChangeActions changeAction, ChangeTargets changeTargets, IEnumerable <T> targets)
        {
            List <ChangeValidationResult> results = new List <ChangeValidationResult>();

            if (!IsChangeAllowedWhileRunScheduledOrActive <T>(changeAction, changeTargets, targets))
            {
                // Change to this data is not allowed while run scheduled or active, check if any runs
                var runs = _runRepository.GetAll().Where(r => r.Scenarios.Where(s => s.IsScheduledOrRunning).Any()).ToList();
                foreach (var run in runs)
                {
                    results.Add(new ChangeValidationResult(ChangeValidationResult.ResultTypes.Error, run, string.Format("Cannot delete data because run {0} is scheduled or active", run.Description)));
                }
            }
            return(results);
        }
Exemplo n.º 2
0
 public IEnumerable <Run> GetAll() => _runRepository.GetAll();
Exemplo n.º 3
0
 public IActionResult GetAll(int id)
 {
     return(new JsonResult(_runRepo.GetAll(id)));
 }