Asp.net MVC5 - Object reference not set to an instance of an object.

Multi tool use
Multi tool use


Asp.net MVC5 - Object reference not set to an instance of an object.



I'm training on Asp.net MVC5. and I did the follow.



Model Name is Movie, with code as below.,


namespace mvc1.Models
{
public class Movie
{
public int Id { get; set; }
public string Name { get; set; }

}



And a Controller with name 'MoviesConroller'. and a using statement "using mvc1.Models".


public ActionResult Random()
{

var movie = new Movie() { Name = "Star Trek!" };
return View();
}



And a View with name Random


@model mvc1.Models.Movie
@{
ViewBag.Title = "Random";
Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@Model.Name</h2>



and this is the error i get
Error









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

JdF Or0hnD9eSQ5nNzOHVhYihPVATPpS3,A
vFIwDJ2TUnwyp xHpRfqUy1AQ2bRbVBANHctvf2pO8333Dnx5 ujOWHCqEd56 t,LADweksW1H6jJQ64Qg

Popular posts from this blog

Rothschild family

Cinema of Italy