/// <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); }
public IEnumerable <Run> GetAll() => _runRepository.GetAll();
public IActionResult GetAll(int id) { return(new JsonResult(_runRepo.GetAll(id))); }