public async Task <IActionResult> AddBot(string name, string token, string message) { var botDto = _botsRepository.AddBot(new Bot { Name = Regex.Replace(name, @"\s+", ""), Token = token, NetworkingEnabled = true, CognitiveServicesEnabled = true, StartMessage = message }); var userId = HttpContext.Session.GetString("userId"); _systemUserRepository.AddBotToUser(userId, botDto.Id.ToString()); await _httpClient.GetStringAsync($"{_configuration["RunnerApiUrl"]}/start?id={botDto.Id}"); return(Redirect($"/bot?id={botDto.Id}")); }
public JsonResult AddBot(string name, string token, string message) { if (string.IsNullOrEmpty(name)) { return(Json(false)); } if (string.IsNullOrEmpty(token)) { return(Json(false)); } var botDto = _botsRepository.AddBot(new Bot { Name = name, Token = token, NetworkingEnabled = true, CognitiveServicesEnabled = true, StartMessage = message }); return(botDto != null ? Json(botDto.Transform()) : Json(false)); }