C#C
C#2y ago
Ayin

How things get to the place

I have found this one thing by Microsoft that confused me so much
public async Task<IActionResult> OnPostTryValidateAsync()
{
    var modifiedReleaseDate = DateTime.Now.Date;
    Movie.ReleaseDate = modifiedReleaseDate;

    ModelState.ClearValidationState(nameof(Movie));
    if (!TryValidateModel(Movie, nameof(Movie)))
    {
        return Page();
    }

    _context.Movies.Add(Movie);
    await _context.SaveChangesAsync();

    return RedirectToPage("./Index");
}

Here, how did we get object of Movie? Method doesn't have any aprameters so I simply cannot get it
Was this page helpful?