Пример #1
0
        public ViewResult Index(string txtSearch, string txtCode, string txtAddress)
        {
            IEnumerable <WarehouseViewModel> q = WarehouseRepository.GetAllWarehouse().AsEnumerable()
                                                 .Select(item => new WarehouseViewModel
            {
                Id             = item.Id,
                CreatedUserId  = item.CreatedUserId,
                CreatedDate    = item.CreatedDate,
                ModifiedUserId = item.ModifiedUserId,
                ModifiedDate   = item.ModifiedDate,
                Name           = item.Name,
                Code           = item.Code,
                Address        = item.Address,
                BranchId       = item.BranchId
            }).OrderByDescending(m => m.ModifiedDate);

            if (string.IsNullOrEmpty(txtSearch) == false || string.IsNullOrEmpty(txtCode) == false || string.IsNullOrEmpty(txtAddress) == false)
            {
                txtSearch  = txtSearch == "" ? "~" : Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(txtSearch);
                txtCode    = txtCode == "" ? "~" : txtCode.ToLower();
                txtAddress = txtAddress == "" ? "~" : txtAddress.ToLower();
                q          = q.Where(x => Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(x.Name).Contains(txtSearch) || x.Code.ToLowerOrEmpty().Contains(txtCode) || Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(x.Address).Contains(txtAddress));
            }
            if (!Erp.BackOffice.Filters.SecurityFilter.IsAdmin())
            {
                //lấy tất cả kho mà user quản lý hiện ra
                // admin thì hiện tất cả
                q = q.Where(x => ("," + Helpers.Common.CurrentUser.DrugStore + ",").Contains("," + x.BranchId + ",") == true);
            }
            ViewBag.SuccessMessage = TempData["SuccessMessage"];
            ViewBag.FailedMessage  = TempData["FailedMessage"];
            ViewBag.AlertMessage   = TempData["AlertMessage"];
            return(View(q));
        }
Пример #2
0
        public ViewResult Index(string txtSearch, string txtCode, string txtAddress)
        {
            IEnumerable <WarehouseViewModel> q = WarehouseRepository.GetAllWarehouse().Where(x => x.BranchId == Helpers.Common.CurrentUser.BranchId)
                                                 .Select(item => new WarehouseViewModel
            {
                Id             = item.Id,
                CreatedUserId  = item.CreatedUserId,
                CreatedDate    = item.CreatedDate,
                ModifiedUserId = item.ModifiedUserId,
                ModifiedDate   = item.ModifiedDate,
                Name           = item.Name,
                Code           = item.Code,
                Address        = item.Address
            }).OrderByDescending(m => m.ModifiedDate);

            if (string.IsNullOrEmpty(txtSearch) == false || string.IsNullOrEmpty(txtCode) == false || string.IsNullOrEmpty(txtAddress) == false)
            {
                txtSearch  = txtSearch == "" ? "~" : Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(txtSearch);
                txtCode    = txtCode == "" ? "~" : txtCode.ToLower();
                txtAddress = txtAddress == "" ? "~" : txtAddress.ToLower();
                q          = q.Where(x => Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(x.Name).Contains(txtSearch) || x.Code.ToLowerOrEmpty().Contains(txtCode) || Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(x.Address).Contains(txtAddress));
            }

            ViewBag.SuccessMessage = TempData["SuccessMessage"];
            ViewBag.FailedMessage  = TempData["FailedMessage"];
            ViewBag.AlertMessage   = TempData["AlertMessage"];
            return(View(q));
        }
Пример #3
0
        public HttpResponseMessage GetAllWarehouses()
        {
            var ware      = warehouseRepository.GetAllWarehouse();
            var formatter = RequestFormat.JsonFormaterString();

            return(Request.CreateResponse(HttpStatusCode.OK, ware, formatter));
        }
Пример #4
0
        public ActionResult Create()
        {
            var model = new PhysicalInventoryViewModel();

            var warehouseList = WarehouseRepository.GetAllWarehouse().AsEnumerable()
                                .Select(item => new SelectListItem
            {
                Text  = item.Name,
                Value = item.Id.ToString()
            });

            ViewBag.warehouseList = warehouseList;
            var manufacturer = categoryRepository.GetCategoryByCode("manufacturerList").AsEnumerable()
                               .Select(item => new SelectListItem
            {
                Text  = item.Name,
                Value = item.Value
            });

            ViewBag.manufacturer = manufacturer;
            return(View(model));
        }
Пример #5
0
        public ActionResult Create()
        {
            var model = new PhysicalInventoryViewModel();

            model.Type = PhysicalInventoryType.Product;
            var warehouseList = WarehouseRepository.GetAllWarehouse().Where(x => x.BranchId == Helpers.Common.CurrentUser.BranchId).AsEnumerable()
                                .Select(item => new SelectListItem
            {
                Text  = item.Name,
                Value = item.Id.ToString()
            });

            ViewBag.warehouseList = warehouseList;
            var manufacturer = categoryRepository.GetCategoryByCode("manufacturerList").AsEnumerable()
                               .Select(item => new SelectListItem
            {
                Text  = item.Name,
                Value = item.Value
            });

            ViewBag.manufacturer = manufacturer;
            return(View(model));
        }
Пример #6
0
        public ViewResult Index(string category, string manufacturer, string txtSearch, string txtCode, int?page, string status)
        {
            List <string> ListCheck    = new List <string>();
            var           status_check = Request["status_check"];

            if (!string.IsNullOrEmpty(status_check))
            {
                ListCheck = status_check.Split(',').ToList();
            }

            //List<vwProduct> listProduct = new List<vwProduct>();
            var listProduct = ProductRepository.GetAllvwProductByType("product").Where(x => x.NoInbound != true);

            if (ListCheck.Count() > 0)
            {
                listProduct = listProduct.Where(id1 => ListCheck.Contains(id1.ProductGroup));
            }
            if (string.IsNullOrEmpty(category) == false)
            {
                listProduct = listProduct.Where(x => x.CategoryCode == category);
            }
            if (string.IsNullOrEmpty(manufacturer) == false)
            {
                listProduct = listProduct.Where(x => x.Manufacturer == manufacturer);
            }
            if (string.IsNullOrEmpty(txtSearch) == false)
            {
                txtSearch   = Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(txtSearch);
                listProduct = listProduct.Where(x => Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(x.Name).Contains(txtSearch));
            }

            if (string.IsNullOrEmpty(txtCode) == false)
            {
                txtCode     = txtCode.ToLower();
                listProduct = listProduct.Where(x => x.Code.ToLower().Contains(txtCode));
            }
            if (!string.IsNullOrEmpty(status))
            {
                listProduct = listProduct.Where(x => x.StatusInventory == status);
            }

            var pager = new Pager(listProduct.Count(), page, 20);

            var viewModel = new IndexViewModel <ProductViewModel>
            {
                Items = listProduct.OrderBy(m => m.Code).Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize)
                        .Select(item => new ProductViewModel
                {
                    Id                     = item.Id,
                    Name                   = item.Name,
                    Code                   = item.Code,
                    PriceInbound           = item.PriceInbound,
                    Type                   = item.Type,
                    Unit                   = item.Unit,
                    ModifiedDate           = item.ModifiedDate,
                    MinInventory           = item.MinInventory,
                    MinInventoryAlarms     = item.MinInventoryAlarms,
                    QuantityTotalInventory = item.QuantityTotalInventory,
                    CategoryCode           = item.CategoryCode,
                    ProductGroup           = item.ProductGroup
                }).ToList(),
                Pager = pager
            };

            List <InventoryViewModel> inventoryList = new List <InventoryViewModel>();

            foreach (var item in viewModel.Items)
            {
                List <InventoryViewModel> inventoryP = InventoryRepository.GetAllInventoryByProductId(item.Id)
                                                       .Select(itemV => new InventoryViewModel
                {
                    ProductId   = itemV.ProductId,
                    Quantity    = itemV.Quantity,
                    WarehouseId = itemV.WarehouseId
                }).ToList();

                if (inventoryP.Count > 0)
                {
                    inventoryList.AddRange(inventoryP);
                }
            }

            List <WarehouseViewModel> warehouseList = WarehouseRepository.GetAllWarehouse()
                                                      .Select(item => new WarehouseViewModel
            {
                Id         = item.Id,
                Name       = item.Name,
                Code       = item.Code,
                Address    = item.Address,
                Categories = item.Categories
            }).ToList();

            if (ListCheck.Count() > 0)
            {
                warehouseList = warehouseList.Where(id1 => ListCheck.Any(id2 => id1.Categories != null && id1.Categories.Contains(id2.ToString()))).ToList();
            }
            //lấy danh sách loại kho
            var categoryList = _categoryRepository.GetCategoryByCode("Categories_product").Select(x => new CategoryViewModel
            {
                Code        = x.Code,
                Description = x.Description,
                Id          = x.Id,
                Name        = x.Name,
                Value       = x.Value,
                OrderNo     = x.OrderNo
            }).ToList();

            ViewBag.Category = categoryList.OrderBy(x => x.OrderNo).ToList();

            ViewBag.inventoryList = inventoryList;
            ViewBag.warehouseList = warehouseList;

            ViewBag.SuccessMessage = TempData["SuccessMessage"];
            ViewBag.FailedMessage  = TempData["FailedMessage"];
            ViewBag.AlertMessage   = TempData["AlertMessage"];


            ViewBag.listcheck = ListCheck;
            return(View(viewModel));
        }
Пример #7
0
 public List <WarehouseDto> GetAllWarehouse()
 {
     return(_warehouseRepository.GetAllWarehouse());
 }
Пример #8
0
        public ActionResult Detail(int?Id)
        {
            var model = new RequestInboundViewModel();
            var modelproductInbound  = new ProductInboundViewModel();
            var modelproductOutbound = new ProductOutboundViewModel();
            var requestInbound       = new vwRequestInbound();
            var productInbound       = new vwProductInbound();
            var productOutbound      = new vwProductOutbound();

            if (Id != null && Id.Value > 0)
            {
                requestInbound = RequestInboundRepository.GetvwRequestInboundById(Id.Value);
                if (requestInbound.InboundId != null && requestInbound.InboundId.Value > 0)
                {
                    productInbound = productInboundRepository.GetvwProductInboundFullById(requestInbound.InboundId.Value);
                    AutoMapper.Mapper.Map(productInbound, modelproductInbound);
                    modelproductInbound.CreatedUserName = userRepository.GetUserById(modelproductInbound.CreatedUserId.Value).FullName;
                }
                if (requestInbound.OutboundId != null && requestInbound.OutboundId.Value > 0)
                {
                    productOutbound = productOutboundRepository.GetvwProductOutboundFullById(requestInbound.OutboundId.Value);
                    AutoMapper.Mapper.Map(productOutbound, modelproductOutbound);
                    modelproductOutbound.CreatedUserName = userRepository.GetUserById(modelproductOutbound.CreatedUserId.Value).FullName;
                }
            }
            ViewBag.productInbound  = modelproductInbound;
            ViewBag.productOutbound = modelproductOutbound;
            AutoMapper.Mapper.Map(requestInbound, model);
            model.CreatedUserName = userRepository.GetUserById(requestInbound.CreatedUserId.Value).FullName;
            model.DetailList      = RequestInboundRepository.GetAllvwRequestInboundDetailsByInvoiceId(requestInbound.Id).AsEnumerable().Select(x =>
                                                                                                                                               new RequestInboundDetailViewModel
            {
                Id                = x.Id,
                Price             = x.Price,
                ProductId         = x.ProductId,
                Quantity          = x.Quantity,
                Unit              = x.Unit,
                CategoryCode      = x.CategoryCode,
                ProductName       = x.ProductName,
                ProductCode       = x.ProductCode,
                ProductGroup      = x.ProductGroup,
                Manufacturer      = x.Manufacturer,
                ProductBarCode    = x.ProductBarCode,
                RequestInboundId  = x.RequestInboundId,
                QuantityRemaining = x.QuantityRemaining,
                ProductGroupName  = x.ProductGroupName,
                Image_Name        = x.Image_Name
            }).OrderBy(x => x.Id).ToList();
            var warehouse = WarehouseRepository.GetAllWarehouse().Where(x => x.IsSale == true && x.BranchId == null).ToList();

            if (warehouse.Count() > 0)
            {
                // var wh = warehouse.FirstOrDefault().Id;
                var productList = Domain.Helper.SqlHelper.QuerySP <InventoryViewModel>("spSale_Get_Inventory", new { WarehouseId = "", HasQuantity = "1", ProductCode = "", ProductName = "", CategoryCode = "", ProductGroup = "", BranchId = "", LoCode = "", ProductId = "", ExpiryDate = "" });
                productList = productList.Where(id1 => warehouse.Any(id2 => id2.Id == id1.WarehouseId)).ToList();
                foreach (var item in model.DetailList)
                {
                    var quantity = productList.Where(x => x.ProductId == item.ProductId).Sum(x => x.Quantity);
                    item.QuantityInventoryKT  = quantity == null ? 0 : quantity;
                    item.QuantityNotCondition = item.QuantityInventoryKT <= 0 ? 1 : 0;
                }
            }
            var ProductInvoiceList = SqlHelper.QuerySP <ProductInvoiceViewModel>("spSale_LiabilitiesDrugStore", new
            {
                StartDate  = "",
                EndDate    = "",
                branchId   = model.BranchId,
                CityId     = "",
                DistrictId = ""
            }).ToList();

            //var inbound = productInboundRepository.GetAllProductInbound().Where(x => x.BranchId == model.BranchId&&x.IsArchive==true).Sum(x => x.TotalAmount);
            model.Liabilities = 0;
            var invoice = ProductInvoiceList.Where(x => x.AccountancyUserId == null).Sum(x => x.TotalAmount);

            model.Liabilities    = invoice;
            model.MaxDebitAmount = branchRepository.GetBranchById(model.BranchId.Value).MaxDebitAmount;
            var tonkho = Domain.Helper.SqlHelper.QuerySP <InventoryViewModel>("spSale_Get_Inventory", new { WarehouseId = model.WarehouseDestinationId, HasQuantity = "1", ProductCode = "", ProductName = "", CategoryCode = "", ProductGroup = "", BranchId = "", LoCode = "", ProductId = "", ExpiryDate = "" }).ToList();

            model.DinhMucKho = tonkho.Sum(x => x.Quantity * x.ProductPriceOutbound) + invoice;
            //var user = userRepository.GetUserById(WebSecurity.CurrentUserId);
            //ViewBag.User = user;
            return(View(model));
        }
        public ActionResult Create(int?Id)
        {
            RequestInboundViewModel model = new RequestInboundViewModel();

            model.DetailList = new List <RequestInboundDetailViewModel>();
            if (Id.HasValue && Id > 0)
            {
                var requestInbound = RequestInboundRepository.GetvwRequestInboundById(Id.Value);
                AutoMapper.Mapper.Map(requestInbound, model);

                var detailList = RequestInboundRepository.GetAllvwRequestInboundDetailsByInvoiceId(requestInbound.Id).ToList();
                AutoMapper.Mapper.Map(detailList, model.DetailList);
            }
            var warehouseList = WarehouseRepository.GetAllWarehouse().Where(x => x.BranchId == Helpers.Common.CurrentUser.BranchId).AsEnumerable()
                                .Select(item => new SelectListItem
            {
                Text  = item.Name,
                Value = item.Id.ToString()
            });

            ViewBag.warehouseList = warehouseList;

            string image_folder_product = Helpers.Common.GetSetting("product-image-folder");
            var    productList          = ProductRepository.GetAllProduct().Where(x => x.Type == "product").AsEnumerable()
                                          .Select(item => new ProductViewModel
            {
                Code         = item.Code,
                Barcode      = item.Barcode,
                Name         = item.Name,
                Id           = item.Id,
                CategoryCode = string.IsNullOrEmpty(item.CategoryCode) ? "Sản phẩm khác" : item.CategoryCode,
                PriceInbound = item.PriceInbound,
                Unit         = item.Unit,
                Image_Name   = Erp.BackOffice.Helpers.Common.KiemTraTonTaiHinhAnh(item.Image_Name, "product-image-folder", "product")
            });

            ViewBag.productList   = productList;
            model.CreatedDate     = DateTime.Now;
            model.CreatedUserName = Helpers.Common.CurrentUser.FullName;
            ViewBag.isAdmin       = Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId == 1 ? true : false;
            if (model.DetailList != null && model.DetailList.Count > 0)
            {
                foreach (var item in model.DetailList)
                {
                    var product = productList.Where(i => i.Id == item.ProductId).FirstOrDefault();
                    if (product == null)
                    {
                        item.Id = 0;
                    }
                }

                model.DetailList.RemoveAll(x => x.Id == 0);

                int n = 0;
                foreach (var item in model.DetailList)
                {
                    item.OrderNo = n;
                    n++;
                }
            }
            return(View(model));
        }
Пример #10
0
        public ActionResult Create(int?Id)
        {
            var model = new RePayPointsViewModel();

            model.DetailList = new List <RePayPointsDetailViewModel>();
            if (Id.HasValue && Id > 0)
            {
                #region Cập nhật
                var rePayPoint = RePayPointsService.Get(Id.Value);
                //Nếu đã ghi sổ rồi thì không được sửa
                if (rePayPoint.IsArchive == true)
                {
                    TempData[Globals.FailedMessageKey] = "Đã ghi sổ. không được chỉnh sửa";
                    return(RedirectToAction("Detail", new { Id = rePayPoint.Id }));
                }

                AutoMapper.Mapper.Map(rePayPoint, model);

                var detailList = vwRePayPointsDetailService.GetAllvwRePayPointsDetailByRePayPointId(rePayPoint.Id);
                AutoMapper.Mapper.Map(detailList, model.DetailList);
                #endregion
            }
            else
            {
                //Nhân viên
                string id_default_user = Helpers.Common.GetSetting("id_default_user");
                int    deaultUserId    = string.IsNullOrEmpty(id_default_user) ? 0 : Convert.ToInt32(id_default_user);
                var    deaultUser      = userRepository.GetUserById(deaultUserId);

                if (deaultUser != null)
                {
                    model.SaleId = deaultUser.Id;
                }
                model.TotalPoint        = 0;
                model.WarehouseSourceId = WarehouseRepository.GetAllWarehouse()
                                          .Where(x => x.BranchId == Helpers.Common.CurrentUser.BranchId && x.Categories.Contains("GIFT")).FirstOrDefault()?.Id;
            }
            var productList = ProductRepository.GetAllvwProduct().Where(x => x.Type == "gift" || x.QuantityTotalInventory > 0 || x.NoInbound == true);
            if (model.DetailList != null && model.DetailList.Count > 0)
            {
                foreach (var item in model.DetailList)
                {
                    var product = productList.Where(i => i.Id == item.GiftId).FirstOrDefault();
                    if (product != null)
                    {
                        item.GiftCode = product.Code;
                    }
                    else
                    {
                        item.Id = 0;
                    }
                }
                model.DetailList.RemoveAll(x => x.Id == 0);
                int n = 0;
                foreach (var item in model.DetailList)
                {
                    item.OrderNo = n;
                    n++;
                }
            }
            return(View(model));
        }
Пример #11
0
        public ViewResult Index(string WarehouseId, string branchId, string conHang, string group, string category, string txtSearch, string txtCode, string CityId, string DistrictId, int?page)
        {
            branchId    = branchId == null ? "" : branchId;
            WarehouseId = WarehouseId == null ? "" : WarehouseId;
            group       = group == null ? "" : group;
            category    = category == null ? "" : category;
            txtSearch   = txtSearch == null ? "" : txtSearch;
            txtCode     = txtCode == null ? "" : txtCode;
            CityId      = CityId == null ? "" : CityId;
            DistrictId  = DistrictId == null ? "" : DistrictId;
            //Nếu là CN thì chỉ thấy của nó
            //string WarehouseId = "";
            var user = userRepository.GetByvwUserName(Helpers.Common.CurrentUser.UserName);

            if (!Filters.SecurityFilter.IsAdmin() && !Filters.SecurityFilter.IsKeToan() && !Filters.SecurityFilter.IsQLKhoTong() && string.IsNullOrEmpty(branchId))
            {
                branchId = user.DrugStore;
            }

            if (string.IsNullOrEmpty(conHang))
            {
                conHang = "1";
            }
            var listInventory = Domain.Helper.SqlHelper.QuerySP <InventoryViewModel>("spSale_Get_Inventory", new { WarehouseId = WarehouseId, HasQuantity = conHang, ProductCode = txtCode, ProductName = txtSearch, CategoryCode = category, ProductGroup = group, BranchId = branchId, LoCode = "", ProductId = "", ExpiryDate = "" });
            var listProduct   = Domain.Helper.SqlHelper.QuerySP <InventoryViewModel>("spSale_Get_ListProductFromInventory", new { WarehouseId = WarehouseId, HasQuantity = conHang, ProductCode = txtCode, ProductName = txtSearch, CategoryCode = category, ProductGroup = group, BranchId = branchId, CityId = CityId, DistrictId = DistrictId });

            //var q = ProductRepository.GetAllvwProductByType("product").ToList();

            if (string.IsNullOrEmpty(CityId) == false)
            {
                listInventory = listInventory.Where(x => x.CityId == CityId).ToList();
                //listProduct = listProduct.Where(x => x.CityId == CityId).ToList();
            }

            if (string.IsNullOrEmpty(DistrictId) == false)
            {
                listInventory = listInventory.Where(x => x.DistrictId == DistrictId).ToList();
                //listProduct = listProduct.Where(x => x.DistrictId == DistrictId).ToList();
            }

            //if (string.IsNullOrEmpty(txtSearch) == false)
            //{
            //    txtSearch = Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(txtSearch);
            //    q = q.Where(x => Erp.BackOffice.Helpers.Common.ChuyenThanhKhongDau(x.Name).Contains(txtSearch)).ToList();
            //}

            //if (string.IsNullOrEmpty(txtCode) == false)
            //{
            //    txtCode = txtCode.ToLower();
            //    q = q.Where(x => x.Code.ToLower().Contains(txtCode)).ToList();
            //}
            var warehouseList = new List <WarehouseViewModel>();

            //Lấy danh sách kho
            //if (Filters.SecurityFilter.IsAdmin() || user.UserTypeCode == "KT")
            //{
            warehouseList = WarehouseRepository.GetAllWarehouse()
                            .Select(item => new WarehouseViewModel
            {
                Id       = item.Id,
                Name     = item.Name,
                Code     = item.Code,
                Address  = item.Address,
                Note     = item.Note,
                BranchId = item.BranchId
            }).OrderBy(x => x.Name).ToList();

            //ViewBag.warehouseList = warehouseList;
            //}
            //else
            //{
            //    warehouseList = WarehouseRepository.GetAllWarehouse().AsEnumerable()
            //        .Where(x => ("," + user.WarehouseId + ",").Contains("," + x.Id + ",") == true)
            //        .Select(item => new WarehouseViewModel
            //        {
            //            Id = item.Id,
            //            Name = item.Name,
            //            Code = item.Code,
            //            Address = item.Address,
            //            Note = item.Note,
            //            BranchId = item.BranchId
            //        }).OrderBy(x => x.Note).ToList();
            //    //ViewBag.warehouseList = warehouseList;
            //}
            if (!string.IsNullOrEmpty(branchId))
            {
                warehouseList = warehouseList.Where(x => x.BranchId != null && ("," + branchId + ",").Contains("," + x.BranchId.Value.ToString() + ",") == true).ToList();
            }
            if (!string.IsNullOrEmpty(WarehouseId))
            {
                warehouseList = warehouseList.Where(x => ("," + WarehouseId + ",").Contains("," + x.Id + ",") == true).ToList();
            }
            ViewBag.inventoryList = listInventory.ToList();
            warehouseList         = warehouseList.Where(id1 => listInventory.Any(id2 => id2.WarehouseId == id1.Id)).ToList();
            var pager = new Pager(warehouseList.Count(), page, 20);

            var pageIndexViewModel = new IndexViewModel <WarehouseViewModel>
            {
                Items = warehouseList.OrderBy(m => m.Code).Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize)
                        .Select(item => new WarehouseViewModel
                {
                    Id      = item.Id,
                    Name    = item.Name,
                    Code    = item.Code,
                    Address = item.Address,
                }).ToList(),
                Pager = pager
            };

            ViewBag.ProductList    = listProduct.ToList();
            ViewBag.SuccessMessage = TempData["SuccessMessage"];
            ViewBag.FailedMessage  = TempData["FailedMessage"];
            ViewBag.AlertMessage   = TempData["AlertMessage"];

            return(View(pageIndexViewModel));
        }