I cannot fetch the data to the view from ViewModel. What should I do?

I’ve been trying to update the products and add them onto the index page. However, there is something wrong with my viewmodels. I also cannot fetch other data from other viewmodels. The upsert option cannot be done. What are the possible reasons and how can I approach the problem? The list that you see doesn’t get updated.

Model:

public class ProductVM
{
    public Product Product { get; set; }

    [ValidateNever]
    public IEnumerable<SelectListItem> CategoryList { get; set; }

    
}

View:

@using Jewelry.Models.ViewModels
@model ProductVM

<div class="card shadow border-0 my-4">
    <div class="card-header bg-secondary bg-gradient ml-0 py-3">
        <div class="row">
            <div class="col-12 text-center">
                <h2 class="text-white py-2">Ürün Oluştur</h2>
            </div>
        </div>
    </div>
    <div class="card-body p-4">
        <form method="post" class="row" enctype="multipart/form-data">
            <input asp-for="Product.Id" hidden />
            <input asp-for="Product.ImageUrl" hidden />
            <div class="row">
                <div class="col-10">
                    <div class="border p-3">
                        <div class="row pb-2">
                            @* <h2 class="text-primary">Kategori Oluştur</h2> *@
                        </div>
                        @* <div asp-validation-summary="ModelOnly"></div> *@
                        <div class="form-floating py-2 col-12">
                            <input asp-for="Product.Title" class="form-control border-0 shadow" />
                            <label asp-for="Product.Title" class="ms-2"></label>
                            <span asp-validation-for="Product.Title" class="text-danger"></span>
                        </div>
                        <div class="py-2 col-12">
                            <label asp-for="Product.Description" class="ms-2"></label>
                            <textarea asp-for="Product.Description" class="form-control border-0 shadow"></textarea>
                        </div>
                        <div class="form-floating py-2 col-12">
                            <input asp-for="Product.Characteristics" class="form-control border-0 shadow" />
                            <label asp-for="Product.Characteristics" class="ms-2"></label>
                            <span asp-validation-for="Product.Characteristics" class="text-danger"></span>
                        </div>
                        <div class="form-floating py-2 col-12">
                            <input asp-for="Product.ListPrice" class="form-control border-0 shadow" />
                            <label asp-for="Product.ListPrice" class="ms-2"></label>
                            <span asp-validation-for="Product.ListPrice" class="text-danger"></span>
                        </div>
                        <div class="form-floating py-2 col-12">
                            <select asp-for="Product.CategoryId" asp-items="@Model.CategoryList" class="form-select border-0 shadow">
                                <option disabled selected>--Kategori Seç</option>
                            </select>
                            <label asp-for="Product.CategoryId" class="ms-2"></label>
                            <span asp-validation-for="Product.CategoryId" class="text-danger"></span>
                        </div>
                        <div class="form-floating py-2 col-12">
                            <input type="file" name="file" class="form-control border-0 shadow" />
                            <label asp-for="Product.ImageUrl" class=" ms-2"></label>
                        </div>
                        <div class="row">
                            <div class="col-6 col-md-3">
                                @if (Model.Product.Id != 0)
                                {
                                    <button type="submit" class="btn btn-primary form-control">Güncelle</button>
                                }
                                else
                                {
                                    <button type="submit" class="btn btn-primary form-control">Oluştur</button>
                                }

                            </div>
                            <div class="col-6 col-md-3">
                                <a asp-controller="Product" asp-action="Index" class="btn btn-outline-primary border form-control">
                                    Listeye Geri Dön
                                </a>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="col-2">
                    <img src="@Model.Product.ImageUrl" width="75%"
                         style="border-radius:5px; border:1px solid #bbb9b9" />
                </div>
            </div>
        </form>

    </div>
</div>


@section Scripts {

    @{
        <partial name="_ValidationScriptsPartial" />
    }

}

Controller:

public IActionResult Upsert(int? id)
{

    ProductVM productVM = new()
    {
        CategoryList = _unitOfWork.Category.GetAll().Select(u => new SelectListItem
        {
            Text = u.Name,
            Value = u.Id.ToString()
        }),

        Product = new Product()
    };

    if (id == null || id == 0)
    {
        return View(productVM);
    }
    else
    {
        productVM.Product = _unitOfWork.Product.Get(u => u.Id == id);
        return View(productVM);
    }
}



[HttpPost]
public IActionResult Upsert(ProductVM productVM, IFormFile? file)
{

    if (ModelState.IsValid)
    {
        string wwwRootPath = _webHostEnvironment.WebRootPath;
        if (file != null)
        {
            string fileName = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName);
            string productPath = Path.Combine(wwwRootPath, @"imagesproduct");

            if (!string.IsNullOrEmpty(productVM.Product.ImageUrl))
            {
                var oldImagePath = Path.Combine(wwwRootPath, productVM.Product.ImageUrl.TrimStart('\'));

                if (System.IO.File.Exists(oldImagePath))
                {
                    System.IO.File.Delete(oldImagePath);
                }
            }


            using (var fileStream = new FileStream(Path.Combine(productPath, fileName), FileMode.Create))
            {
                file.CopyTo(fileStream);
            }

            productVM.Product.ImageUrl = @"imagesproduct" + fileName;
        }

        if (productVM.Product.Id == 0)
        {
            _unitOfWork.Product.Add(productVM.Product);
        }

        else
        {
            _unitOfWork.Product.Update(productVM.Product);
        }


        _unitOfWork.Save();
        TempData["success"] = "Ürün başarılı bir şekilde oluşturuldu.";
        return RedirectToAction("Index");
    }
    else
    {
        productVM.CategoryList = _unitOfWork.Category.GetAll().Select(u => new SelectListItem
        {
            Text = u.Name,
            Value = u.Id.ToString()
        });

        return View(productVM);
    }

}

I tried to change the viewmodel into the model of Product only but it turns out to be wrong because of I cannot change the controller.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật