public ActionResult UpdateProduct(AddOrUpdateProductModel addOrUpdateProductModel, string filter)
 {
     if (ModelState.IsValid)
     {
         if (addOrUpdateProductModel.Images.FirstOrDefault() != null)
         {
             string folderPath = Server.MapPath($"~/Content/image/product/{addOrUpdateProductModel.Product.Id}");
             Directory.CreateDirectory(folderPath);
             foreach (var image in addOrUpdateProductModel.Images)
             {
                 string imagePaht = Server.MapPath($"~/Content/image/product/{addOrUpdateProductModel.Product.Id}/{image.FileName}");
                 image.SaveAs(imagePaht);
                 ir.AddOrUpdate(new Image()
                 {
                     ProductId = addOrUpdateProductModel.Product.Id, Paht = $"/Content/image/product/{addOrUpdateProductModel.Product.Id}/{image.FileName}"
                 });
             }
         }
         pr.AddOrUpdate(addOrUpdateProductModel.Product);
         return(RedirectToAction("ProductList", new { filter = filter }));
     }
     ViewBag.MainCat = new SelectList(mcr.SelectAll(), "Id", "Name", scr.SelectById(addOrUpdateProductModel.Product.SubCategoryId).MainCategoryId);
     ViewBag.SubCat  = new SelectList(mcr.SelectById(scr.SelectById(addOrUpdateProductModel.Product.SubCategoryId).MainCategoryId).SubCategories, "Id", "Name", ViewBag.Filter = filter);
     return(View(addOrUpdateProductModel));
 }