public async Task OnGetAsync(long?id)
        {
            if (id.HasValue)
            {
                Dto = await _service.GetByIdAsync(id.Value);

                if (Dto == null)
                {
                    throw new KuDataNotFoundException();
                }
                ViewData["Mode"] = "Edit";
            }
            else
            {
                Dto = new SmsAccountDto();
                ViewData["Mode"] = "Add";
            }
        }
Beispiel #2
0
        public async Task <IActionResult> AccountEdit(long?id)
        {
            if (id.HasValue)
            {
                //编辑
                var model = await _accountService.GetByIdAsync(id.Value);

                if (model == null)
                {
                    throw new VinoDataNotFoundException("无法取得数据!");
                }
                ViewData["Mode"] = "Edit";
                return(View(model));
            }
            else
            {
                //新增
                SmsAccountDto dto = new SmsAccountDto();
                ViewData["Mode"] = "Add";
                return(View(dto));
            }
        }