public async void GoToBD(ChatBotUnitOfWork ChatBot) { User user = ChatBot.CommonUsersRepository.FindByPhone(Number).Result; if (user == null) { user = new User(Number); await ChatBot.CommonUsersRepository.Create(user); } if (OperatorVar == null) { OperatorVar = Response[0][0]; } Operator oper = new Operator("Kek", "Cheburek", "Login", "Password"); MessageInfo MesInfo = new MessageInfo(); MesInfo.User = user; MesInfo.Operator = oper; MesInfo.Message = Request; MesInfo.Date = DateTime.Now; MesInfo.OperatorsVar = OperatorVar; MesInfo.Agility = 0.5f; MesInfo.VarOne = Response[0][0] + " : " + Response[0][1]; MesInfo.VarTwo = Response[1][0] + " : " + Response[1][1]; MesInfo.VarThree = Response[2][0] + " : " + Response[2][1]; await ChatBot.MessagesRepository.Create(MesInfo); await ChatBot.SaveAsync(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ChatBotUnitOfWork ChatBot = new ChatBotUnitOfWork(@"Server = (localdb)\mssqllocaldb; Database = ChatBotDB; Trusted_Connection = True;", TimeSpan.FromMinutes(1), 30); services.AddSingleton(ChatBot); services.AddMvc(); }
public HomeController(ChatBotUnitOfWork unit) { _unit = unit; //Jsons kek = new Jsons() //{ // Number = "22354", // Request = "Tochno?", // Response = new string[3][] { new string[2] { "da", "88" }, new string[2] { "net", "55" }, new string[2] { "mb", "10" } } //}; //listJ.listJ.Add(kek); }