public async Task <PM_Component_Submit> GetCustomById(string id) { var model = new PM_Component_Submit(); var obj = await GetById(id); if (obj != null) { model = await GetCustomByModel(obj); } return(await Task.FromResult(model)); }
public async Task <PM_Component_Submit> GetCustomByModel(PM_Component model) { var obj = new PM_Component_Submit() { Id = model.Id, ParentId = model.ParentId, Title = model.Title, Code = model.Code, DateCreated = model.DateCreated, DateEnd = model.DateEnd, DateStart = model.DateStart, Description = model.Description, Label = model.Label, Note = model.Note, ProjectId = model.ProjectId, Status = model.Status }; return(await Task.FromResult(obj)); }
private void Children(List <PM_Component_Submit> listChild, List <PM_Component_Submit> allFunction, List <SelectListModel> lst, PM_Component_Submit itemParent) { //Kiểm tra có dữ liệu chưa if (listChild.Any()) { foreach (var item in listChild) { //Nếu có thì duyệt tiếp để lưu vào list lst.Add(new SelectListModel { ItemValue = item.Id, ItemText = itemParent.Title + " \\ " + item.Title }); //Gọi action để lấy danh sách submenu theo id var child = allFunction.Where(c => c.ParentId == item.Id).ToList(); //Gọi action để lấy danh sách submenu theo id if (child.Any()) { item.Title = itemParent.Title + " \\ " + item.Title; Children(child, allFunction, lst, item); } } } }