public OperationResult <Nothing> Handle(SaveDomainObject <RecognizedChoicePart> command)
 {
     using (var context = new ImageProcessingContext(_persistenceConfiguration))
     {
         try
         {
             context.Set <RecognizedChoicePart>().Add(command.ObjectToSave);
             context.SaveChanges();
             return(OperationResult <Nothing> .Success(new Nothing()));
         }
         catch (Exception ex)
         {
             return(OperationResult <Nothing> .Failure(new UncaughtException(ex)));
         }
     }
 }
Beispiel #2
0
        public OperationResult <Nothing> Handle(CreateDocumentToProcess command)
        {
            using (var context = new ImageProcessingContext(_persistenceConfiguration))
            {
                try
                {
                    var document = new DocumentToProcessPersistenceModel
                    {
                        Id = command.Id,
                        RequesterIdentifier          = command.RequesterIdentifier,
                        TemplateDefinitionIdentifier = command.TemplateDefinitionIdentifier
                    };

                    context.DocumentsToProcess.Add(document);
                    context.SaveChanges();

                    return(OperationResult <Nothing> .Success(new Nothing()));
                }
                catch (Exception ex)
                {
                    return(OperationResult <Nothing> .Failure(new UncaughtException(ex)));
                }
            }
        }