Why are these errors appearing in Razor when compiling the project?

Asked

Viewed 162 times

0

Changes made by me

@model Pessoa; // já tentei module3.Models.Pessoa e todas as variacoes    possiveis
@{
    ViewData["Title"] = "Pessoa";
}

h2> @ViewData["Title"]</h2>
<p>Name: @model.Nome </p>


<p>Id:@model.Id</p>

namespace module3.Models
{
    public class Pessoa
    {
        public int Id { get; set; }
        public string Nome { get; set; }
    }
}

public IActionResult Pessoa()
{
    var pessoa = new Pessoa{Id=12,Nome="2324"};
    return View(); 
}

/home/developer/Documentos/dotnet/module3/Views/Home/Pessoa.cshtml(1,6): error RZ1011: The 'page' directives value(s) must be separated by whitespace. [/home/developer/Documentos/dotnet/module3/module3.csproj]
/home/developer/Documentos/dotnet/module3/Views/Home/Pessoa.cshtml(6,14): error RZ2005:The 'model` directive must appear at the start of the line. [/home/developer/Documentos/dotnet/module3/module3.csproj]
/home/developer/Documentos/dotnet/module3/Views/Home/Pessoa.cshtml(6,19): error RZ1011:The 'model' directives value(s) must be separated by whitespace. [/home/developer/Documentos/dotnet/module3/module3.csproj]
/home/developer/Documentos/dotnet/module3/Views/Home/Pessoa.cshtml(7,11): error RZ2005:The 'model` directive must appear at the start of the line. [/home/developer/Documentos/dotnet/module3/module3.csproj]
/home/developer/Documentos/dotnet/module3/Views/Home/Pessoa.cshtml(7,10): error RZ2001:The 'model' directive may only occur once per document. [/home   /developer/Documentos/dotnet/module3/module3.csproj]
/home/developer/Documentos/dotnet/module3/Views/Home/Pessoa.cshtml(7,16): error RZ1011:The 'model' directives value(s) must be separated by whitespace.          [/home/developer/Documentos/dotnet/module3/module3.csproj]
   0 Warning(s)
   6 Error(s)
  • Looks like we’re missing just put on first line one @page

  • sorry to leiguice, but then I remove @model or put before, the course I’m seeing seems to be outdated :/ pq this in Asp.net core 1.0

  • Try to put first is the @page, then the rest as it is. Enjoying that you are learning, take a look at the ASP Net Razor Pages. https://www.youtube.com/watch?v=yyBijyCI5Sk

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.