public IActionResult Add()
        {
            List <SelectListItem> categoryListItems = _categoryManager.GetAll().Select(c => new SelectListItem()
            {
                Value = c.Id.ToString(),
                Text  = c.Name
            }).ToList();
            var model = new ViewModel_Product();

            // ViewBag.CategoryItem = categoryListItems;
            model.CategoryListItems = categoryListItems;
            model.ProductList       = _productManager.GetAll();
            return(View(model));
        }
        public IActionResult Add(ViewModel_Product model)
        {
            try
            {
                var product = _mapper.Map <Product>(model);
                if (ModelState.IsValid)
                {
                    bool isAdded = _productManager.Add(product);
                    if (isAdded)
                    {
                        return(RedirectToAction(nameof(ViewProducts)));
                    }
                }

                return(View());
            }
            catch
            {
                return(View());
            }
        }