示例#1
0
        public IHttpActionResult AddLocationPor(List <LocalProduct> localProducts)
        {
            var  localProductService = new LocalProductService();
            bool isResult            = true;

            try
            {
                localProducts.ForEach(item => {
                    var getMax = localProductService.GetAll().LastOrDefault().Sn;
                    var maxGet = Convert.ToInt32(getMax);
                    maxGet++;
                    item.Sn          = Convert.ToString(maxGet);
                    item.StorageName = "产品仓库";
                    item.StorageNum  = "DSP_0000";
                    item.CreateUser  = "******";
                    item.CreateName  = "administrator";
                    item.CreateTime  = DateTime.Now;
                    localProductService.Add(item);
                });
            }
            catch (Exception)
            {
                isResult = false;
                throw;
            }
            var result = new
            {
                Result = isResult,
                Msg    = isResult ? "添加成功" : "添加失败"
            };

            return(Json(result));
        }