public async Task OnGetAsync(long?id, long?pid) { if (id.HasValue) { Dto = await _service.GetByIdAsync(id.Value); if (Dto == null) { throw new VinoDataNotFoundException(); } if (Dto.ParentId.HasValue) { Parents = await _service.GetParentsAsync(Dto.ParentId.Value); } ViewData["Mode"] = "Edit"; } else { Dto = new FunctionDto(); if (pid.HasValue) { Dto.ParentId = pid.Value; Parents = await _service.GetParentsAsync(pid.Value); } else { Dto.ParentId = null; } ViewData["Mode"] = "Add"; } }
public async Task <IActionResult> Index(long?parentId) { var Parents = new List <FunctionDto>(); if (parentId.HasValue) { Parents = await _service.GetParentsAsync(parentId.Value); } ViewData["ParentId"] = parentId; return(View(Parents)); }
public async Task OnGetAsync(long?parentId) { Parents = new List <FunctionDto>(); if (parentId.HasValue) { Parents = await _service.GetParentsAsync(parentId.Value); } ViewData["ParentId"] = parentId; }