示例#1
0
        /// <summary>
        /// 修改栏目
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <ChannelDto> UpdateChannel(UpdateChannelInput input)
        {
            var channel = await _channelManager.ChannelRepository.GetAsync(input.Id);

            var app = await _appManager.GetByIdAsync(channel.AppId);

            if (channel != null)
            {
                if (input.ChannelTemplateId.HasValue)
                {
                    channel.ChannelTemplateId = input.ChannelTemplateId.Value;
                }
                if (input.ContentTemplateId.HasValue)
                {
                    channel.ContentTemplateId = input.ContentTemplateId.Value;
                }

                channel.DisplayName = input.DisplayName;
                channel.Content     = input.Content;
                channel.Description = input.Description;
                channel.FilePath    = input.FilePath;
                channel.ImageUrl    = PageUtils.GetUrlWithoutAppDir(app, input.ImageUrl);
                channel.Keywords    = input.Keywords;
                channel.LinkType    = input.LinkType;
                channel.LinkUrl     = input.LinkUrl;
                channel.ModelType   = input.ModelType;

                await _channelManager.UpdateAsync(channel);
            }
            return(await CreateChannelDto(channel));
        }
示例#2
0
        /// <summary>
        /// 修改栏目
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <ChannelDto> UpdateChannel(UpdateChannelInput input)
        {
            var channel = await _channelManager.ChannelRepository.GetAsync(input.Id);

            if (channel != null)
            {
                if (input.ChannelTemplateId.HasValue)
                {
                    channel.ChannelTemplateId = input.ChannelTemplateId.Value;
                }
                if (input.ContentTemplateId.HasValue)
                {
                    channel.ContentTemplateId = input.ContentTemplateId.Value;
                }

                channel.DisplayName = input.DisplayName;
                await _channelManager.UpdateAsync(channel);
            }
            return(await CreateChannelDto(channel));
        }