コード例 #1
0
        public async Task OnGetAsync(long?id)
        {
            if (id.HasValue)
            {
                Dto = await _service.GetByIdAsync(id.Value);

                if (Dto == null)
                {
                    throw new KuDataNotFoundException();
                }
                BindBoards       = (await _service.GetAdvertisementBoardsAsync(Dto.Id)).Select(x => x.Id).ToArray();
                ViewData["Mode"] = "Edit";
            }
            else
            {
                Dto = new AdvertisementDto();
                ViewData["Mode"] = "Add";
            }

            //广告位列表取得
            Boards = await _boardService.GetListAsync(new AdvertisementBoardSearch { IsDeleted = false }, null);

            if (BindBoards == null)
            {
                BindBoards = new long[] { };
            }
        }