public IEnumerable <OAUnitDefinition> GetAllUnits() { using (var context = new ConfigurationToolContext()) { var repository = new OAUnitDefinitionRepository(context); return(repository.GetAll()); } }
//Cannot delete children yet public void DeleteUnit(OAUnitDefinition unit) { using (ConfigurationToolContext context = new ConfigurationToolContext()) { var repository = new OAUnitDefinitionRepository(context); repository.Delete(unit); context.SaveChanges(); } }
//Gets Procescells, Units, Bins & ParameterDefinitions public FactoryConfig GetFactoryConfig() { using (var context = new ConfigurationToolContext()) { var procescellRepository = new ProcessCellRepository(context); var binRepository = new BinRepository(context); var parameterDefinitionRepository = new ParameterDefinitionRepository(context); var OAUnitDefinitionRepository = new OAUnitDefinitionRepository(context); var factoryConfig = new FactoryConfig(); factoryConfig.ParameterDefinitions = parameterDefinitionRepository.GetAll(); factoryConfig.Procescells = procescellRepository.GetAll(); factoryConfig.Bins = binRepository.GetAll(); factoryConfig.OAUnitDefinitions = OAUnitDefinitionRepository.GetAll(); return(factoryConfig); } }