Exemple #1
0
        public async Task <IActionResult> TempletEdit(long?id)
        {
            //取得短信账号列表
            ViewBag.Accounts = await _accountService.GetListAsync(new SmsAccountSearch { IsDeleted = false }, null);

            if (id.HasValue)
            {
                //编辑
                var model = await _templetService.GetByIdAsync(id.Value);

                if (model == null)
                {
                    throw new VinoDataNotFoundException("无法取得数据!");
                }
                ViewData["Mode"] = "Edit";
                return(View(model));
            }
            else
            {
                //新增
                SmsTempletDto dto = new SmsTempletDto();
                ViewData["Mode"] = "Add";
                return(View(dto));
            }
        }
        public async Task OnGetAsync(long?id)
        {
            //取得短信账号列表
            Accounts = await _accountService.GetListAsync(new SmsAccountSearch { IsDeleted = false }, null);

            if (id.HasValue)
            {
                Dto = await _service.GetByIdAsync(id.Value);

                if (Dto == null)
                {
                    throw new KuDataNotFoundException();
                }
                ViewData["Mode"] = "Edit";
            }
            else
            {
                Dto = new SmsTempletDto();
                ViewData["Mode"] = "Add";
            }
        }
Exemple #3
0
        public async Task <IActionResult> TempletSave(SmsTempletDto model)
        {
            await _templetService.SaveAsync(model);

            return(JsonData(true));
        }