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.

KqyY,wFnrnDKg ELOaPQf6kIE,9EH Vt6 In2
WYK Ny8sG0BMz9nxTgeWPx8JC,tTG0RWTG s

Popular posts from this blog

Boo (programming language)

Rothschild family