Exemplo n.º 1
0
        public async Task OnGetAsync(long id)
        {
            Dto = await _service.GetByIdAsync(id);

            if (Dto == null)
            {
                throw new KuDataNotFoundException();
            }
        }
Exemplo n.º 2
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 DeliveryTempletDto();
                ViewData["Mode"] = "Add";
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(long?id)
        {
            if (id.HasValue)
            {
                //编辑
                var model = await _service.GetByIdAsync(id.Value);

                if (model == null)
                {
                    throw new VinoDataNotFoundException("无法取得数据!");
                }
                ViewData["Mode"] = "Edit";
                return(View(model));
            }
            else
            {
                //新增
                DeliveryTempletDto dto = new DeliveryTempletDto();
                ViewData["Mode"] = "Add";
                return(View(dto));
            }
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Save(DeliveryTempletDto model)
        {
            await _service.SaveAsync(model);

            return(JsonData(true));
        }