My model:
public class Grupo: ModelBase
{
public Grupo()
{
this.Itens = new List<Item>();
}
public Grupo(string nome): this()
{
this.Nome = nome;
}
public string Nome { get; set; }
public virtual ICollection<Item> Itens { get; set; }
}
My repository:
public virtual T BuscaPorId(int id)
{
return _dbSet.Find(id);
}
And my method in my Service class
public Grupo BuscarPorId(int id)
{
return grupoRepository.BuscaPorId(id);
}
When I call in the controller it comes the lists that are in the "Group"
public ActionResult Editar(int Id)
{
if (Id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Grupo grupo = grupoService.BuscarPorId(Id);
But when I click save and step to my Service that calls my method this.BuscarPorId
, exactly the same method that I called in the controller, here it does not load the lists, just the data "Name, Id" p>