Ejemplo n.º 1
0
        public IActionResult Download([FromRoute] int id, [FromRoute] int downloaderId)
        {
            if (torrentService.Download(id, downloaderId))
            {
                return(NoContent());
            }

            return(BadRequest());
        }
Ejemplo n.º 2
0
        public async void Handle(CallbackQueryEventArgs args, TelegramBotClient client)
        {
            var query = args.CallbackQuery.Data.Split('/');

            var scope    = _scopeFactory.CreateScope();
            var database = scope.ServiceProvider.GetRequiredService <DatabaseContext>();

            switch (query[0])
            {
            case "download":
                var sr = database.SearchResponses.First(s => s.Guid == query[1]);

                _torrent.Download(sr, args.CallbackQuery.Message.Chat.Id);

                await client.SendTextMessageAsync(args.CallbackQuery.Message.Chat.Id, $"Downloading {sr.Title}");

                break;
            }
        }