예제 #1
0
        /// <summary>
        /// Adds a new customer registration details into persistence.
        /// </summary>
        /// <param name="customerRegistrationInfo">The new customer registration details to add.</param>
        /// <returns>The resulting customer registration details that get added.</returns>
        public async Task <CustomerViewModel> AddAsync(CustomerViewModel customerRegistrationInfo)
        {
            customerRegistrationInfo.AssertNotNull(nameof(customerRegistrationInfo));

            var customerRegistrationTable = await this.ApplicationDomain.AzureStorageService.GetCustomerRegistrationTableAsync();

            CustomerRegistrationTableEntity customerRegistrationTableEntity = new CustomerRegistrationTableEntity(customerRegistrationInfo);

            var insertionResult = await customerRegistrationTable.ExecuteAsync(TableOperation.Insert(customerRegistrationTableEntity));

            insertionResult.HttpStatusCode.AssertHttpResponseSuccess(ErrorCode.PersistenceFailure, "Failed to add customer registration details", insertionResult.Result);

            return(customerRegistrationInfo);
        }