public void DeleteProcessCellParameter(ProcessCellParameter processCellParameter)
 {
     using (ConfigurationToolContext context = new ConfigurationToolContext())
     {
         var repository = new ProcessCellParameterRepository(context);
         repository.Delete(processCellParameter);
         context.SaveChanges();
     }
 }
        public void CreateNewProcescell(Procescell procescell)
        {
            using (ConfigurationToolContext context = new ConfigurationToolContext())
            {
                var repository = new ProcessCellRepository(context);
                var parameterDefinitionRepository = new ParameterDefinitionRepository(context);

                //Gets required parameters for a new procescell
                IEnumerable <ParameterDefinition> requiredParameters;
                requiredParameters = parameterDefinitionRepository.GetRequiredParameters("pca_ProcCellPars", procescell.prc_ProcescellTypeId);

                //convert parDef to proccellPars and add them to the procescell
                foreach (ParameterDefinition paf in requiredParameters)
                {
                    ProcessCellParameter pca = new ProcessCellParameter(procescell, paf);
                    procescell.ProcessCellParameters.Add(pca);
                }

                //this always happens at the end of the method
                repository.Add(procescell);
                context.SaveChanges();
            }
        }