public async Task <ChannelDto> CreateChannel(CreateChannelInput input) { var channel = new Channel(AppId, input.DisplayName, input.ParentId); var app = await _appManager.GetByIdAsync(channel.AppId); if (input.ChannelTemplateId.HasValue) { channel.ChannelTemplateId = input.ChannelTemplateId.Value; } if (input.ContentTemplateId.HasValue) { channel.ContentTemplateId = input.ContentTemplateId.Value; } 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.CreateAsync(channel); await CurrentUnitOfWork.SaveChangesAsync(); return(channel.MapTo <ChannelDto>()); }
public async Task <CreateChannelPayload> CreateChannel( [Service] IChannelRepository channelRepository, CreateChannelInput input) { var channel = await channelRepository.CreateChannel( input.WorkspaceName, input.ChannelName); return(new(channel)); }
public async Task <ChannelDto> CreateChannel(CreateChannelInput input) { var channel = new Channel(AppId, input.DisplayName, input.ParentId); if (input.ChannelTemplateId.HasValue) { channel.ChannelTemplateId = input.ChannelTemplateId.Value; } if (input.ContentTemplateId.HasValue) { channel.ContentTemplateId = input.ContentTemplateId.Value; } await _channelManager.CreateAsync(channel); await CurrentUnitOfWork.SaveChangesAsync(); return(channel.MapTo <ChannelDto>()); }