Ejemplo n.º 1
0
        public ICommandResult Handle(GetFlowCommand command)
        {
            ICommandResult result = new GetFlowCommandResult();

            _loggingService.Log(this.GetType(), ELogType.Neutral, ELogLevel.Debug, new { command.Flow, command.RequestHost }, "FlowCommandHandler.Handle(Get)");

            try
            {
                if (_flowRepository.CheckExists(command.Flow))
                {
                    Flow flow = _flowRepository.Get(command.Flow);

                    if (flow != null)
                    {
                        result = new GetFlowCommandResult(200, flow.Owner, flow.OwnerType, flow.Object, flow.CreationDate, flow.Path);
                    }
                }

                else if (_flowRepository.Valid)
                {
                    result = new GetFlowCommandResult(400, new Notification("Flow", "Could not be found"));
                }
            }
            catch (Exception e)
            {
                _loggingService.Log(this.GetType(), ELogType.Neutral, ELogLevel.Error, new { command.Flow, command.RequestHost }, e);
            }

            return(result);
        }
Ejemplo n.º 2
0
 public Flow Get(int id)
 {
     return(_flowRepository.Get(id));
 }