Exemplo n.º 1
0
        public IActionResult ProductListData(int page, int limit)
        {
            List <ProductInformationViewModel> productInfolist = new List <ProductInformationViewModel>();
            var users = _productInformationService.GetList("", page, limit);

            if (users.Item1 != null && users.Item1.Count > 0)
            {
                foreach (var user in users.Item1)
                {
                    UserViewModel vm = new UserViewModel();
                    vm.CreateTime = user.CreateTime.ToString("yyyy-MM-dd");
                    vm.ID         = user.Id;
                    vm.Name       = user.Name;
                    if (user.RoleID > 0)
                    {
                        var info = _userRoleService.Get(user.RoleID);
                        if (info != null)
                        {
                            vm.RoleName = info.RoleName;
                        }
                    }
                    vm.TelPhone = user.TelPhone;
                    vm.UserName = user.UserName;
                    userlist.Add(vm);
                }
            }
            return(Json(new { code = 0, msg = "", count = users.Item2, data = userlist.ToArray() }));
        }
Exemplo n.º 2
0
        public IActionResult ProductListData(int page, int limit)
        {
            List <ProductInformationViewModel> productList = new List <ProductInformationViewModel>();
            var productinfos = _productInformationService.GetList(page, limit);

            if (productinfos.Item1 != null && productinfos.Item1.Count > 0)
            {
                foreach (var product in productinfos.Item1)
                {
                    BatchInformation            batchInfo = _batchInformationService.GetBatchInfoById(product.BatchId);
                    ProductInformationViewModel vm        = new ProductInformationViewModel();
                    vm.Id                = product.Id;
                    vm.Code              = product.ProductCode;
                    vm.Name              = product.ProductName;
                    vm.StockStatusType   = product.StockType;
                    vm.ProductStatusType = product.ProductStatus;
                    vm.ClassType         = product.Type;
                    vm.BatchId           = product.BatchId;
                    vm.BatchName         = batchInfo != null ? batchInfo.Name : string.Empty;
                    productList.Add(vm);
                }
            }
            return(Json(new { code = 0, msg = "", count = productinfos.Item2, data = productList.ToArray() }));
        }