I want to get a List of items from Model to view, but i am not getting Exact Idea of That Please Help Me I am Adding my all class
Below
public class DivisionDTO
{
public Guid Id { get; set; }
public string Name { get; set; }
public List<GroupDTO> Groups { get; set; }
}
public class GroupDTO
{
public Guid Id { get; set; }
public string Name { get; set; }
public List<Team> Teams { get; set; }
}
public class Team
{
public int ID { get; set; }
public string TeamName { get; set; }
public int GroupId { get; set; }
public int DivisionId { get; set; }
public string pld { get; set; }
public string W { get; set; }
public string D { get; set; }
public string L { get; set; }
public string GF { get; set; }
public string GA { get; set; }
public string GD { get; set; }
public string Pts { get; set; }
}
The model itself is a list of items and every items contain List of child items as well. in DivisionDTO Class list GroupDTO values is there and in GroupDTO class Team value is there
My controller Code is following
public ActionResult EditGroup()
{
CreatingLeague.Models.DivisionDTO division = new CreatingLeague.Models.DivisionDTO();
division.Id = new Guid();
division.Name = "Div";
division.Groups = new List<CreatingLeague.Models.GroupDTO>();
CreatingLeague.Models.Team team = new Models.Team();
team.TeamName = "TeamA";
division.Groups.Add(new CreatingLeague.Models.GroupDTO() { Id = new Guid(), Name = "G1", Teams = new List<Team>() { team } });
return View(division);
}
I want to make a edit page can any one give me idea of that