예제 #1
0
        public async Task <ActionResult <Channel> > PostChannel(createChannelDTO input)
        {
            var newChannel = await channelRepository.CreateNewChannel(input);

            var username = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
            await userChannelRepository.AddUserToChannel(username, input.name);

            return(newChannel);
        }
예제 #2
0
        public async Task <Channel> CreateNewChannel(createChannelDTO input)
        {
            Channel newChannel = new Channel
            {
                Name = input.name,
                Type = input.type,
            };

            _context.Channel.Add(newChannel);
            await _context.SaveChangesAsync();

            return(newChannel);
        }