zoukankan      html  css  js  c++  java
  • JS:传对象数组到后台

    页面:

    <script>
        function improve() {
            var improveForm = $('#improveForm');
    
            if (!improveForm.valid()) {
                abp.message.warn("请完善信息");
                return;
            }
    
            agencyLevelArray = $("[name='agencyLevel']");
            isFirstArray = $("[name='isFirst']");
            purchaseCountArray = $("[name='purchaseCount']");
            priceArray = $("[name='price']");
    
            package = [];
    
            for (i = 0; i < agencyLevelArray.length; i++) {
                package[i] = {
                    ProductId: @product.Id,
                    AgencyLevel: agencyLevelArray[i].value,
                    IsFirst: isFirstArray[i].value,
                    PurchaseCount: purchaseCountArray[i].value,
                    Price: priceArray[i].value
                }
            };
    
            abp.services.app.product.improveProductPackage({
                ProductPackage: package
            }).done(function () {
                abp.message.warn("msg", "添加成功");
            })
        }
    </script>

    Dto:

    public class ProductPackageDto
    {
      /// <summary>
       ///     商品Id
       /// </summary>
       [Required]
      public long ProductId { get; set; }
    
      /// <summary>
      ///     代理等级
      /// </summary>
      [Required]
      public AgencyLevel AgencyLevel { get; set; }
    
      /// <summary>
      ///     是否为初次
      /// </summary>
      public bool IsFirst { get; set; }
    
      /// <summary>
      ///     单次购买量
      /// </summary>
      public decimal PurchaseCount { get; set; }
    
      /// <summary>
      ///     分销价格
      /// </summary>
       [Required]
      public decimal Price { get; set; }
    }
    
    public class ProductPackageList
    {
      public List<ProductPackageDto> ProductPackage { get; set; }
    }
    

    后台:

    public async Task ImproveProductPackage(ProductPackageList input)
    {
      
    }
  • 相关阅读:
    测试用例练习2
    测试小尝试
    两个栈实现队列 Python实现
    treap Python实现
    AVL树Python实现(使用递推实现添加与删除)
    AVL树Python实现
    跳表(skiplist)Python实现
    红黑树Python实现
    Django Middleware 之 SessionMiddleware
    软件测试——Peer Review(简介)
  • 原文地址:https://www.cnblogs.com/Cchblogs/p/7232767.html
Copyright © 2011-2022 走看看