예제 #1
0
        public IActionResult AddEdit(int modelId)
        {
            var model = new Products();

            if (modelId > 0)
            {
                model = _productService.Get(modelId);
                if (model != null)
                {
                    ViewBag.ListImport = _importService.GetAllByProductId(modelId);
                    ViewBag.NoStock    = _productService.NoStock(modelId);
                }
            }

            var ListCate = new List <SelectListItem>();
            var ListUnit = new List <SelectListItem>();

            BuildCatesAndUnits(model, ref ListCate, ref ListUnit);
            ViewBag.ListCate = ListCate.ToArray();
            ViewBag.ListUnit = ListUnit.ToArray();
            return(View(model));
        }