示例#1
0
        /// <summary>
        /// Update customer of an app by Id
        /// </summary>
        /// <exception cref="Flipdish.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="appId">App Name Id</param>
        /// <param name="customerId">Customer Id</param>
        /// <param name="updateCustomer">Updated customer information</param>
        /// <returns>ApiResponse of RestApiResultCustomer</returns>
        public ApiResponse <RestApiResultCustomer> UpdateCustomerByIdWithHttpInfo(string appId, int?customerId, CustomerUpdateModel updateCustomer)
        {
            // verify the required parameter 'appId' is set
            if (appId == null)
            {
                throw new ApiException(400, "Missing required parameter 'appId' when calling CustomersApi->UpdateCustomerById");
            }
            // verify the required parameter 'customerId' is set
            if (customerId == null)
            {
                throw new ApiException(400, "Missing required parameter 'customerId' when calling CustomersApi->UpdateCustomerById");
            }
            // verify the required parameter 'updateCustomer' is set
            if (updateCustomer == null)
            {
                throw new ApiException(400, "Missing required parameter 'updateCustomer' when calling CustomersApi->UpdateCustomerById");
            }

            var    localVarPath         = "/api/v1.0/{appId}/customers/{customerId}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml",
                "application/x-www-form-urlencoded"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (appId != null)
            {
                localVarPathParams.Add("appId", this.Configuration.ApiClient.ParameterToString(appId));                // path parameter
            }
            if (customerId != null)
            {
                localVarPathParams.Add("customerId", this.Configuration.ApiClient.ParameterToString(customerId));                     // path parameter
            }
            if (updateCustomer != null && updateCustomer.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(updateCustomer); // http body (model) parameter
            }
            else
            {
                localVarPostBody = updateCustomer; // byte array
            }

            // authentication (oauth2) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
                                                                                                 Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                 localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("UpdateCustomerById", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <RestApiResultCustomer>(localVarStatusCode,
                                                           localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                           (RestApiResultCustomer)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(RestApiResultCustomer))));
        }
示例#2
0
        /// <summary>
        /// Update customer of an app by Id
        /// </summary>
        /// <exception cref="Flipdish.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="appId">App Name Id</param>
        /// <param name="customerId">Customer Id</param>
        /// <param name="updateCustomer">Updated customer information</param>
        /// <returns>Task of RestApiResultCustomer</returns>
        public async System.Threading.Tasks.Task <RestApiResultCustomer> UpdateCustomerByIdAsync(string appId, int?customerId, CustomerUpdateModel updateCustomer)
        {
            ApiResponse <RestApiResultCustomer> localVarResponse = await UpdateCustomerByIdAsyncWithHttpInfo(appId, customerId, updateCustomer);

            return(localVarResponse.Data);
        }
示例#3
0
 //Update data
 public async Task <int> UpdateCustomers(CustomerUpdateModel customerUpdateModel)
 {
     return(await _customerRepository.UpdateCustomers(customerUpdateModel));
 }
示例#4
0
        /// <summary>
        /// Update customer of an app by Id
        /// </summary>
        /// <exception cref="Flipdish.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="appId">App Name Id</param>
        /// <param name="customerId">Customer Id</param>
        /// <param name="updateCustomer">Updated customer information</param>
        /// <returns>RestApiResultCustomer</returns>
        public RestApiResultCustomer UpdateCustomerById(string appId, int?customerId, CustomerUpdateModel updateCustomer)
        {
            ApiResponse <RestApiResultCustomer> localVarResponse = UpdateCustomerByIdWithHttpInfo(appId, customerId, updateCustomer);

            return(localVarResponse.Data);
        }
示例#5
0
        public int Create(CustomerUpdateModel customer)
        {
            var model = ToModel(customer);

            return(_repository.Save(model).Id);
        }
示例#6
0
        public async Task UpdateAsync([FromBody] CustomerUpdateModel updateModel)
        {
            var model = updateModel.ToModel();

            await _customerService.UpdateAsync(model);
        }
示例#7
0
 public IActionResult Update([FromBody] CustomerUpdateModel model)
 {
     return(Ok(_customerServieces.UpdateCustomer(model)));
 }
示例#8
0
 public Task <Customer> UpdateAsync(CustomerUpdateModel customer)
 {
     return(CustomerDataAccess.UpdateAsync(customer));
 }
 public static Customer ConvertToEntity(this CustomerUpdateModel updateModel)
 => new Customer
 {
     Name = new FullName(updateModel.FirstName, updateModel.MiddleName, updateModel.LastName)
 };