I have a project called Billing. Inside, there is a folder called Models where my models are (only 2). One of them is called an invoice and I need to fill a table (bootstrap) with the data of this model. I need to do something like this, unless there is another way I still do not know:
@foreach(var item in Model)
{
........
}
So I need to declare the model in my View, right? I'm doing this:
@model IEnumerable<Fatura>
and is giving this error:
The type or namespace name 'Invoice' could not be found (are you missing a using directive or an assembly reference?)
If I put a @using ProjectName.PastaModels before, it gives the error:
Using directve is unnecessary
How do I use a model in my view to populate a table?
I did this on my controller
public class HomeController : Controller
{
// GET: Home
private Conexao contexto = new Conexao();
public ActionResult Index()
{
return View(contexto.Faturas.ToList());
}
}
And it says context is never assigned to...