コード例 #1
0
        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";
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
ファイル: Index.cshtml.cs プロジェクト: zdlian/Ku.Core.CMS
 public async Task OnGetAsync(long?parentId)
 {
     Parents = new List <FunctionDto>();
     if (parentId.HasValue)
     {
         Parents = await _service.GetParentsAsync(parentId.Value);
     }
     ViewData["ParentId"] = parentId;
 }