Open YSternlicht opened 1 year ago
Hi @YSternlicht.
The [BindProperty] is introduced and explained not in this model tutorial, but in the scaffolding tutorial.
"The Movie property uses the [BindProperty] attribute to opt-in to model binding. When the Create form posts the form values, the ASP.NET Core runtime binds the posted values to the Movie model."
I will have to look into the 2nd item as I have time, which is also introduced and explained in the scaffolding tutorial, not this model tutorial this issue is on.
I understand that. But I particularly asked why it was used on the Delete.cshtml.cs model where there, it is not needed.
Since the Delete.cshtml.cs has a post method which accepts the id (of the movie) can you explain why the Movie property is decorated with the [BindProperty] attribute?
Another (different yet related) point is, why in the OnPostAsync does it assign movie to Movie and then delete Movie. Why not leave out the assignment and remove movie directly?
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.