public IActionResult Add()
        {
            var model      = new ProductUpdateModel();
            var categories = model.GetAllCategoryList();

            ViewBag.CategoryList = categories;
            return(View(model));
        }
        public IActionResult Add(ProductUpdateModel model)
        {
            if (ModelState.IsValid)
            {
                var imageUrl = model.ImageUpload(model.ProductImage);
                model.AddNewProductItem(imageUrl);
            }

            var categories = model.GetAllCategoryList();

            ViewBag.CategoryList = categories;
            return(View(model));
        }
        public IActionResult Add(ProductUpdateModel model)
        {
            if (ModelState.IsValid)
            {
                string path   = null;
                var    userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

                if (model.Image != null)
                {
                    path = model.GetUploadedImage(model.Image.FileName);
                }
                model.AddNewProduct(path, userId);
            }
            var categories = model.GetAllCategoryList();

            ViewBag.CategoryList = categories;
            return(View(model));
        }