i can’t save the invoice data in razor pages .Net8

in razor pages i am trying to save invoice data to sql table sales but But when you press the Save Invoice button, nothing happens, not even an error message, and the data is not saved I checked everything and found no errors
this is my cshtml.cs code

Note that there is a select list for both item names and customer names

using AfterFix.Pages.Clients;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;

namespace AfterFix.Pages.Sales
{
    public class NewSalesModel : PageModel
    {
        private readonly string _connectionString = "Data Source=DESKTOP-9CABSPL\SQLEXPRESS;Initial Catalog=mystore;Integrated Security=True;MultipleActiveResultSets=true";

        public class Invoice
        {
            // Define properties relevant to an invoice
            public string InvoiceNumber { get; set; }
            public DateTime InvoiceDate { get; set; } = DateTime.Now;
            public string CustomerName { get; set; }
            // Other properties as needed
        }
        // Fetch customers

        public List<SelectListItem> CustomerList { get; set; } = new List<SelectListItem>();
        public List<SelectListItem> Items { get; set; } = new List<SelectListItem>();
        public Invoice invoice = new Invoice();
        public string errorMessage = "";
        public string SuccsesMessage = "";

        public void OnGet()
        {
            using (var connection = new SqlConnection(_connectionString))
            {
                connection.Open();
                var query = "SELECT Id, Name FROM customers";
                using (var command = new SqlCommand(query, connection))
                {
                    var reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        var customerId = reader["Id"].ToString();
                        var customerName = reader["Name"].ToString();
                        CustomerList.Add(new SelectListItem
                        {
                            Value = customerId,
                            Text = customerName
                        });
                    }
                }
                // Fetch items
                var itemQuery = "SELECT Id, ItemName FROM items"; // Adjust the query according to your database schema
                using (var itemCommand = new SqlCommand(itemQuery, connection))
                {
                    var itemReader = itemCommand.ExecuteReader();
                    while (itemReader.Read())
                    {
                        var itemId = itemReader["Id"].ToString();
                        var itemName = itemReader["ItemName"].ToString();
                        Items.Add(new SelectListItem
                        {
                            Value = itemId,
                            Text = itemName
                        });
                    }
                }
            }
        }

        public int SelectedCustomerId { get; set; }
        //public int InvoiceId { get; set; } // For existing invoices (optional)
        // public string InvoiceNumber { get; set; }
        // public DateTime InvoiceDate { get; set; } = DateTime.Now;  // Defaults to current date
        // public int CustomerId { get; set; }
        // public string CustomerName { get; set; }

        public void OnPost()
        {
            invoice.InvoiceNumber = Request.Form["InvoiceNumber"];

            // Parse InvoiceDate
            if (!DateTime.TryParse(Request.Form["InvoiceDate"], out DateTime invoiceDate))
            {
                errorMessage = "";
                return;
            }
            invoice.InvoiceDate = invoiceDate;

            // Parse CustomerId
            // Parse the CustomerName from the appropriate form field
            string customerName = Request.Form["CustomerName"];

            // Validate if the parsed value is not null or empty
            if (string.IsNullOrEmpty(customerName))
            {
                errorMessage = "";
                return;
            }

            // Assign the parsed CustomerName to invoice.CustomerName
            invoice.CustomerName = customerName;


            // Validation
            if (string.IsNullOrEmpty(invoice.InvoiceNumber) ||
                invoice.InvoiceDate == DateTime.MinValue ||
                invoice.CustomerName == null)
            {
                errorMessage = "";
                return;
            }

            // Save to database
            try
            {
                string connectionString = "Server=DESKTOP-9CABSPL\SQLEXPRESS;Database=mystore;Trusted_Connection=True;MultipleActiveResultSets=true";
                using (SqlConnection connection = new SqlConnection(connectionString))

                {
                    string sql = "INSERT INTO sales (InvoiceNumber, InvoiceDate, CustomerName) VALUES (@InvoiceNumber, @InvoiceDate, @CustomerName);";
                    using (SqlCommand command = new SqlCommand(sql, connection))
                    {
                        command.Parameters.AddWithValue("@InvoiceNumber", invoice.InvoiceNumber);
                        command.Parameters.AddWithValue("@InvoiceDate", invoice.InvoiceDate);
                        command.Parameters.AddWithValue("@CustomerName", invoice.CustomerName);
                        command.ExecuteNonQuery();
                    }
                }

            }
            catch (Exception ex)
            {
                // Handle other unexpected exceptions
                // Handle the exception
                errorMessage = "";
                // Log the exception or handle it in another appropriate way
                // Log the exception details
            }

            // Clear input fields and set success message
            invoice.InvoiceNumber = "";
                invoice.InvoiceDate = DateTime.Now;
                invoice.CustomerName = "";
                SuccsesMessage = "";
                Response.Redirect("/sales/Index");
            }
            
        }
    }

and this cshtml code

@page
@model AfterFix.Pages.Sales.NewSalesModel
@{
    ViewData["Title"] = "New Sales Invoice";
}

<h1>New Sales Invoice</h1>

<form method="post" id="invoiceForm">
    <div class="form-group">
        <label for="invoiceNumber">Invoice Number:</label>
        <input type="text" id="invoiceNumber" name="InvoiceNumber" class="form-control" value="@Model.invoice.InvoiceNumber" />
    </div>
    <div class="form-group">
        <label for="invoiceDate">Invoice Date:</label>
        <input type="date" id="invoiceDate" name="InvoiceDate" class="form-control" value="@Model.invoice.InvoiceDate.ToString("yyyy-MM-dd")" />
    </div>
    <div class="form-group">
        <label for="customerName">Customer:</label>
        <select id="customerName" name="SelectedCustomerName" class="form-control " value="@Model.invoice.CustomerName" />
            <option value="">Select Customer</option>
            @foreach (var customer in Model.CustomerList)
            {
                <option value="@customer.Value">@customer.Text</option>
            }
        </select>
    </div>
    <table class="table" id="itemsTable">
        <thead>
            <tr>
                <th>Item</th>
                <th>Quantity</th>
                <th>Price</th>
                <th>Total Price</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    <select name="Items" class="form-control item" onchange="calculateTotal()">
                        <option value="">Select Item</option>
                        @foreach (var item in Model.Items)
                        {
                            <option value="@item.Value">@item.Text</option>
                        }
                    </select>
                </td>
                <td><input type="number" name="Quantities" class="form-control quantity" onchange="calculateTotal()" /></td>
                <td><input type="number" name="Prices" class="form-control price" onchange="calculateTotal()" /></td>
                <td><input type="number" name="TotalPrice" class="form-control total" readonly /></td>
                <td><button type="button" class="btn btn-danger" onclick="deleteRow(this)">Delete</button></td>
            </tr>
        </tbody>
    </table>
    <button type="button" class="btn btn-success" onclick="addRow()">Add Item</button>
    <br />
    <div class="form-group">
        <label for="totalPrice">Total Price:</label>
        <input type="number" id="totalPrice" name="TotalPrice" class="form-control" readonly />
    </div>
    <button type="submit" class="btn btn-primary">Save Invoice</button>
</form>

@section scripts {
    <script>
        function calculateTotal() {
            var rows = document.querySelectorAll("#itemsTable tbody tr");
            var total = 0;
            rows.forEach(function (row) {
                var quantity = parseFloat(row.querySelector(".quantity").value) || 0;
                var price = parseFloat(row.querySelector(".price").value) || 0;
                var totalPrice = quantity * price;
                row.querySelector(".total").value = totalPrice.toFixed(2);
                total += totalPrice;
            });
            document.getElementById("totalPrice").value = total.toFixed(2);
        }

        function deleteRow(btn) {
            var row = btn.closest("tr");
            row.parentNode.removeChild(row);
            calculateTotal();
        }

        function addRow() {
            var table = document.getElementById("itemsTable").getElementsByTagName('tbody')[0];
            var newRow = table.insertRow(table.rows.length);
            newRow.innerHTML = `
                                <td><select name="Items" class="form-control item" onchange="calculateTotal()"><option value="">Select Item</option>@foreach (var item in Model.Items)
        {
                        <option value="@item.Value">@item.Text</option>
        }</select></td>
                                <td><input type="number" name="Quantities" class="form-control quantity" onchange="calculateTotal()" /></td>
                                <td><input type="number" name="Prices" class="form-control price" onchange="calculateTotal()" /></td>
                                <td><input type="number" name="TotalPrice" class="form-control total" readonly /></td>
                                <td><button type="button" class="btn btn-danger" onclick="deleteRow(this)">Delete</button></td>
                            `;
        }


    </script>
}

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