public async Task <ActionResult <ListResult> > Add([FromBody] AddRequest request) { if (await _channelGroupRepository.IsExistsAsync(request.SiteId, request.GroupName)) { return(this.Error("保存失败,已存在相同名称的栏目组!")); } var groupInfo = new ChannelGroup { SiteId = request.SiteId, GroupName = request.GroupName, Description = request.Description }; await _channelGroupRepository.InsertAsync(groupInfo); await _authManager.AddSiteLogAsync(request.SiteId, "新增栏目组", $"栏目组:{groupInfo.GroupName}"); var groups = await _channelGroupRepository.GetChannelGroupsAsync(request.SiteId); var groupNames = groups.Select(x => x.GroupName); return(new ListResult { GroupNames = groupNames, Groups = groups }); }
public async Task <ActionResult <GetResult> > Get([FromQuery] SiteRequest request) { if (!await _authManager.HasSitePermissionsAsync(request.SiteId, Types.SitePermissions.SettingsChannelGroup)) { return(Unauthorized()); } var groups = await _channelGroupRepository.GetChannelGroupsAsync(request.SiteId); return(new GetResult { Groups = groups }); }