What is the @ (arroba) serving in both the controller and the view ?
In View , tells the Razor engine that the following code should be interpreted by .NET. Can be used on a line:
@if (condicao) { ... }
Or it can serve as opening a block:
@{
var minhaVariavel = ...;
}
In theory, the Razor engine interprets any .NET code, but the most used ones are C # and VB.NET.
I do not recommend using the latter because business logic in View should be discouraged, since View is for presentation, not logic. It is important to know that the resource exists but that it should not be used as in PHP.
What is the purpose of these { get; set; }
calls that staff put into model ?
They are automatic properties ( auto properties ). It's a concise way of writing the following:
private int _id;
public int id {
get { return _id; }
set { _id = value; }
}
Because property setting is widely used, leaner writing saves programmer effort.