public async Task <ActionResult <object> > PostChannel(DTO.ChannelDTO dto)
        {
            var channel = new Channel
            {
                Name    = dto.Channel,
                Link    = dto.Link,
                IdUser  = int.Parse(User.Identity.Name),
                Visible = true,
            };

            _context.Channels.Add(channel);
            await _context.SaveChangesAsync();

            return(new { Id = channel.IdChannel, Channel = channel.Name, Link = channel.Link, Visible = channel.Visible });
        }
        public async Task <IActionResult> PutChannel(int id, DTO.ChannelDTO dto)
        {
            var channel = await _context.Channels.FindAsync(id);

            if (channel == null)
            {
                return(NotFound());
            }

            if (channel.IdUser != int.Parse(User.Identity.Name))
            {
                return(Forbid());
            }

            if (id != channel.IdChannel)
            {
                return(BadRequest());
            }

            channel.Name    = dto.Channel;
            channel.Link    = dto.Link;
            channel.Visible = dto.Visible;

            _context.Entry(channel).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChannelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }