Ejemplo n.º 1
0
        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";
            }
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> AccountSave(SmsAccountDto model)
        {
            await _accountService.SaveAsync(model);

            return(JsonData(true));
        }