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)); } }
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" }); }
public async Task <IActionResult> GetTagList(int page, int rows, WxUserTagSearch where) { var data = await tagService.GetListAsync(page, rows, where, "TagId asc"); return(PagerData(data.items, page, rows, data.count)); }
public async Task <IActionResult> OnPostDataAsync(int page, int rows, WxUserTagSearch where) { var data = await _service.GetListAsync(page, rows, where, null); return(PagerData(data.items, page, rows, data.count)); }