コード例 #1
0
        public async Task <IActionResult> Index()
        {
            var userId         = HttpContext.Session.GetString("userId");
            var botsViewModels =
                await BotsService.GetBotsViewModels(_configuration, _systemUserRepository, _botsRepository, userId);

            return(View(new PageViewModel
            {
                Bots = botsViewModels
            }));
        }
コード例 #2
0
        public async Task <IActionResult> NewBot(string name, string token, string message)
        {
            var userId = HttpContext.Session.GetString("userId");

            var botsViewModels =
                await BotsService.GetBotsViewModels(_configuration, _systemUserRepository, _botsRepository, userId);

            return(View(new PageViewModel
            {
                Bots = botsViewModels.ToArray()
            }));
        }
コード例 #3
0
        public async Task <IActionResult> NewInlineUrlKey(string botId)
        {
            var userId = HttpContext.Session.GetString("userId");
            var bots   = await BotsService.GetBotsViewModels(_configuration, _systemUserRepository, _botsRepository, userId);

            var bot = await BotsService.GetBotViewModel(botId, _configuration, _botsRepository);

            return(View(new PageViewModel
            {
                CurrentBot = bot,
                Bots = bots
            }));
        }
コード例 #4
0
        public async Task <IActionResult> Bot(string id)
        {
            var userId = HttpContext.Session.GetString("userId");

            var botsViewModels =
                await BotsService.GetBotsViewModels(_configuration, _systemUserRepository, _botsRepository, userId);

            var botViewModel = await BotsService.GetBotViewModel(id, _configuration, _botsRepository);

            var textMessages     = _textMessageAnswersRepository.GetTextMessageAnswers(id);
            var inlineKeys       = _inlineKeysRepository.GetInlineKeys(id);
            var inlineUrlKeys    = _inlineUrlKeysRepository.GetUrlInlineUrlKeys(id);
            var interviews       = _interviewsRepository.GetInterviews(id);
            var interviewAnswers = _interviewAnswersRepository.GetInterviewAnswers(id).Select(_ =>
                                                                                              new InterviewAnswerViewModel
            {
                Interview       = _interviewsRepository.GetInterview(_.InterviewId),
                InterviewAnswer = _,
                User            = _usersRepository.GetUser(_.UserId, _.BotId)
            });

            var users = _usersRepository.GetUsers(id).Select(_ => new UserViewModel
            {
                Id         = _.Id.ToString(),
                FirstName  = _.FirstName,
                LastName   = _.LastName,
                UserName   = _.UserName,
                TelegramId = _.TelegramId,
                Networking = JsonConvert.DeserializeObject <UserNetworking>(_.Networking)
            });

            return(View(new PageViewModel
            {
                CurrentBot = botViewModel,
                Bots = botsViewModels,
                TextMessages = textMessages,
                InlineKeys = inlineKeys,
                InlineUrlKeys = inlineUrlKeys,
                Interviews = interviews,
                InterviewAnswers = interviewAnswers,
                Users = users
            }));
        }