public AlgorithmMessage UpdateAlgorithmMessage(AlgorithmMessage message) { return(ExecuteFaultHandledOperation(() => { IAlgorithmInstanceRepository algorithmInstanceRepository = _DataRepositoryFactory.GetDataRepository <IAlgorithmInstanceRepository>(); AlgorithmInstance instance = algorithmInstanceRepository.Get(message.AlgorithmInstanceID); if (instance == null) { NotFoundFault fault = new NotFoundFault(string.Format("No algorithm instance found for instanceId '{0}'.", message.AlgorithmInstanceID)); throw new FaultException <NotFoundFault>(fault, fault.Message); } IAlgorithmMessageRepository messageRepository = _DataRepositoryFactory.GetDataRepository <IAlgorithmMessageRepository>(); AlgorithmMessage updatedEntity = null; if (message.AlgorithmMessageID == 0) { updatedEntity = messageRepository.Add(message); } else { updatedEntity = messageRepository.Update(message); } return updatedEntity; })); }
public AlgorithmInstance[] GetAlgorithmInstances() { return(ExecuteFaultHandledOperation(() => { IAlgorithmInstanceRepository instanceRepository = _DataRepositoryFactory.GetDataRepository <IAlgorithmInstanceRepository>(); IEnumerable <AlgorithmInstance> instances = instanceRepository.Get(); return instances.ToArray(); })); }