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); }
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); }