public static DeploymentEnvironment ToDeploymentEnvironment(this DashboardEnvironmentResource environment) { return(new DeploymentEnvironment { EnvironmentId = environment.Id, Name = environment.Name, }); }
public IEnumerable <INotificationCriterion> GetNotificationCriteria(DashboardProjectResource project, DashboardEnvironmentResource environment) { //TODO : Needs to be a registry/cache put in place to ensure memory is not abused var envs = preferences.Projects .Where(x => x.Name == project.Name) .SelectMany(x => x.Environments) .Where(x => x.Name == environment.Name); var notfiicaitonsForCurrentProjectAndEnvironment = envs.SelectMany(x => x.Notifications); foreach (var notification in notfiicaitonsForCurrentProjectAndEnvironment) { if (!String.IsNullOrEmpty(notification.OnTransitionTo)) { yield return(new StateTransitionCriteria(notification.OnTransitionTo)); } if (!String.IsNullOrEmpty(notification.HasState)) { yield return(new FixedStateCriteria(notification.HasState)); } } ; }