1
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 Pository:
public virtual T BuscaPorId(int id)
{
return _dbSet.Find(id);
}
And my way into 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 on save and pass to my Service calling my method this.BuscarPorId
, exactly the same method I called in the controller, here it does not load the lists, only the data "Name,Id"