Beispiel #1
0
        public async Task <IActionResult> Edit(long?id, long?AccountId)
        {
            if (id.HasValue)
            {
                //编辑
                var model = await service.GetByIdAsync(id.Value);

                if (model == null)
                {
                    throw new VinoDataNotFoundException("无法取得数据!");
                }
                model.Account = await accountService.GetByIdAsync(model.AccountId);

                if (model.Account == null)
                {
                    throw new VinoDataNotFoundException("数据出错!");
                }
                //取得用户标签
                ViewBag.UserTags = await wxUserTagService.GetListAsync(new WxUserTagSearch()
                {
                    AccountId = model.AccountId
                }, "TagId asc");

                ViewData["Mode"] = "Edit";
                return(View(model));
            }
            else
            {
                //新增
                WxMenuDto dto = new WxMenuDto();
                if (AccountId.HasValue)
                {
                    dto.AccountId = AccountId.Value;
                    dto.Account   = await accountService.GetByIdAsync(AccountId.Value);

                    if (dto.Account == null)
                    {
                        throw new VinoDataNotFoundException("参数出错!");
                    }
                }
                else
                {
                    throw new VinoDataNotFoundException("参数出错!");
                }
                //取得用户标签
                ViewBag.UserTags = await wxUserTagService.GetListAsync(new WxUserTagSearch()
                {
                    AccountId = dto.AccountId
                }, "TagId asc");

                ViewData["Mode"] = "Add";
                return(View(dto));
            }
        }
Beispiel #2
0
        public async Task OnGetAsync(long AccountId)
        {
            Account = await _accountService.GetByIdAsync(AccountId);

            if (Account == null)
            {
                throw new KuDataNotFoundException();
            }
        }
Beispiel #3
0
        public async Task OnGetAsync(long?id, long?AccountId)
        {
            if (id.HasValue)
            {
                Dto = await _service.GetByIdAsync(id.Value);

                if (Dto == null)
                {
                    throw new KuDataNotFoundException();
                }
                Dto.Account = await _accountService.GetByIdAsync(Dto.AccountId);

                if (Dto.Account == null)
                {
                    throw new KuDataNotFoundException("数据出错!");
                }
                ViewData["Mode"] = "Edit";
            }
            else
            {
                Dto = new WxMenuDto();
                if (AccountId.HasValue)
                {
                    Dto.AccountId = AccountId.Value;
                    Dto.Account   = await _accountService.GetByIdAsync(AccountId.Value);

                    if (Dto.Account == null)
                    {
                        throw new KuDataNotFoundException("参数出错!");
                    }
                }
                else
                {
                    throw new KuDataNotFoundException("参数出错!");
                }
                ViewData["Mode"] = "Add";
            }

            //取得用户标签
            UserTags = await _userTagService.GetListAsync(new WxUserTagSearch()
            {
                AccountId = Dto.AccountId
            }, new { TagId = "asc" });
        }
Beispiel #4
0
        public async Task <IActionResult> TagEdit(long?id, long?AccountId)
        {
            if (id.HasValue)
            {
                //编辑
                var model = await tagService.GetByIdAsync(id.Value);

                if (model == null)
                {
                    throw new VinoDataNotFoundException("无法取得数据!");
                }
                model.Account = await accountService.GetByIdAsync(model.AccountId);

                if (model.Account == null)
                {
                    throw new VinoDataNotFoundException("数据出错!");
                }
                ViewData["Mode"] = "Edit";
                return(View(model));
            }
            else
            {
                //新增
                WxUserTagDto dto = new WxUserTagDto();
                if (AccountId.HasValue)
                {
                    dto.AccountId = AccountId.Value;
                    dto.Account   = await accountService.GetByIdAsync(AccountId.Value);

                    if (dto.Account == null)
                    {
                        throw new VinoDataNotFoundException("参数出错!");
                    }
                }
                else
                {
                    throw new VinoDataNotFoundException("参数出错!");
                }
                ViewData["Mode"] = "Add";
                return(View(dto));
            }
        }
Beispiel #5
0
        public async Task OnGetAsync(long?id, long?AccountId)
        {
            if (id.HasValue)
            {
                Dto = await _service.GetByIdAsync(id.Value);

                if (Dto == null)
                {
                    throw new KuDataNotFoundException();
                }
                Dto.Account = await _accountService.GetByIdAsync(Dto.AccountId);

                if (Dto.Account == null)
                {
                    throw new KuDataNotFoundException("数据出错!");
                }
                ViewData["Mode"] = "Edit";
            }
            else
            {
                Dto = new WxQrcodeDto();
                if (AccountId.HasValue)
                {
                    Dto.AccountId = AccountId.Value;
                    Dto.Account   = await _accountService.GetByIdAsync(AccountId.Value);

                    if (Dto.Account == null)
                    {
                        throw new KuDataNotFoundException("参数出错!");
                    }
                }
                else
                {
                    throw new KuDataNotFoundException("参数出错!");
                }
                ViewData["Mode"] = "Add";
            }
        }
Beispiel #6
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 WxAccountDto();
                ViewData["Mode"] = "Add";
            }
        }
        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
            {
                //新增
                WxAccountDto dto = new WxAccountDto();
                dto.Type         = EmWxAccountType.Service;
                ViewData["Mode"] = "Add";
                return(View(dto));
            }
        }