Beispiel #1
0
 public virtual ServiceReceiptResponse ForeignKeyModify(ForeignKeyModifyCommand command)
 {
     if (command == null)
     {
         throw new ArgumentNullException(nameof(command));
     }
     try
     {
         return(_commandBus.Publish <ForeignKeyModifyCommand, ServiceReceiptResponse>(command));
     }
     catch (Exception ex)
     {
         throw _foodWasteFaultExceptionBuilder.Build(ex, SoapNamespaces.FoodWasteSystemDataServiceName, MethodBase.GetCurrentMethod());
     }
 }
Beispiel #2
0
        /// <summary>
        /// Executes functionality which modifies a foreign key for a domain object.
        /// </summary>
        /// <param name="foreignKey">Foreign key to modify.</param>
        /// <returns>Identifier for the modified foreign key.</returns>
        public virtual Guid ForeignKeyModify(IForeignKey foreignKey)
        {
            if (foreignKey == null)
            {
                throw new ArgumentNullException("foreignKey");
            }
            if (foreignKey.Identifier.HasValue == false)
            {
                throw new IntranetSystemException(Resource.GetExceptionMessage(ExceptionMessage.IllegalValue, foreignKey.Identifier, "Identifier"));
            }
            var command = new ForeignKeyModifyCommand
            {
                ForeignKeyIdentifier = foreignKey.Identifier.Value,
                ForeignKeyValue      = foreignKey.ForeignKeyValue
            };
            var serviceReceipt = Execute <ForeignKeyModifyCommand, ServiceReceiptResponse>(command);

            return(serviceReceipt.Identifier.HasValue ? serviceReceipt.Identifier.Value : default(Guid));
        }