public static async Task CreateMissionList(string listName, Guid projectId) { using (var missionListSvc = new MissionListService()) { var list = missionListSvc.GetAll(m => m.ProjectId == projectId).ToList(); await missionListSvc.CreateAsync(new MissionList() { ListName = listName, ProjectId = projectId, Order = list.Count() + 1, }, true); } }
public static List <MissionListDto> GetMissionListByProjectId(Guid projectId) { using (var missionListSvc = new MissionListService()) { var list = missionListSvc.GetAll(m => m.ProjectId == projectId).Select(m => new MissionListDto() { Id = m.Id, ListName = m.ListName, Order = m.Order, }).ToList(); foreach (var missionList in list) { var missions = GetMissionByListId(missionList.Id); missionList.Missions = missions; } return(list); } }