public GoalListDto(GoalList GoalList) { GoalListId = GoalList.GoalListId; UserId = GoalList.UserId; Title = GoalList.Title; Goals = new List <GoalItemDto>(); foreach (GoalItem item in GoalList.Goals) { Goals.Add(new GoalItemDto(item)); } }
public GoalList ToEntity() { GoalList Goal = new GoalList { Title = Title, GoalListId = GoalListId, UserId = UserId, StartDate = StartDate, EndDate = EndDate, Description = Description, Category = Category, Goals = new List <GoalItem>() }; foreach (GoalItemDto item in Goals) { Goal.Goals.Add(item.ToEntity()); } return(Goal); }