Esempio n. 1
0
        /// <summary>
        /// Executes the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <returns></returns>
        /// <exception cref="DomainValidationException">Thrown if validation fails</exception>
        public void Execute(CalculationCopyCommand command)
        {
            var aggregate = _repository.GetById(command.OriginalId);

            var copy = new CalculationAggregate();

            copy.Copy(aggregate, command.AggregateId);

            _repository.Save(copy, -1);
        }
Esempio n. 2
0
        /// <summary>
        /// Executes the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <returns></returns>
        /// <exception cref="DomainValidationException">Thrown if validation fails</exception>
        public void Execute(CalculationAddCommand command)
        {
            //TODO: Validate if name is unique ->Exception: Resources.Validation_CalculationNameExists(felt noch)
            //TODO: Validate if name, description is not empty

            var aggregate = new CalculationAggregate(
                command.AggregateId,
                command.Name,
                command.Wkn,
                command.Multiplier,
                command.StrikePrice,
                command.Underlying,
                command.InitialSl,
                command.InitialTp,
                command.PricePerUnit,
                command.OrderCosts,
                command.Description,
                command.Units,
                command.IsLong);

            _repository.Save(aggregate, -1);
        }