That's not how it works. The C# and Razor code executes on the server, and generates a response which is sent back to the client.
(In this case, the response is an HTML page containing some Javascript.) The client then executes the Javascript in response to some event on the client, by which time your
Model
is long gone.
If you want to pass the details from Javascript back to the server, you need to make another request. You can either make an AJAX request, or submit a
<form>
. The server can then process the data that's send with that request, and return a new response.
Ajax - Developer guides | MDN[
^]