public static void Main(string[] args) { using (var context = new ChatbotContext()) { context.Database.Migrate(); } BuildWebHost(args).Run(); }
/// <summary> /// Adds the responce given to the database. /// </summary> /// <returns> /// Returns true if responce was added to the database succesfully, /// returns false otherwise /// </returns> public static bool AddResponce(Responce res, ChatbotContext context) { context.Responce.Add(res); if (context.SaveChanges() == 1) { return(true); } return(false); }
public static void Main(string[] args) { using (var context = new ChatbotContext()) { context.Database.Migrate(); } var container = UnityHelper.Create(); var chatbotService = container.Resolve <ChatbotService>(); chatbotService.Main(); Console.ReadLine(); }
/// <summary> /// Grabs all responces from the database. /// </summary> /// <returns> /// Returns a list of all responces from the database /// </returns> public static List <Responce> GetAllResponces(ChatbotContext context) { List <Responce> res = (from r in context.Responce orderby r.Input select new Responce { ResponceID = r.ResponceID, Input = r.Input, Output = r.Output }).ToList(); context.SaveChanges(); return(res); }
/// <summary> /// Grabs one responce from the database with the same Id given, /// Throws a KeyNotFoundException if not found /// </summary> /// <returns> /// Returns the responce with the same Id /// </returns> internal static Responce GetOneResponce(int responceID, ChatbotContext context) { Responce res = (from r in context.Responce where r.ResponceID == responceID select new Responce { ResponceID = r.ResponceID, Input = r.Input, Output = r.Output }).Single(); context.SaveChanges(); return(res); }
/// <summary> /// Grabs all responces that have an input, and returns that as a list. /// if no such input exists, returns an empty list /// </summary> /// <returns> /// Returns a list of all responces with the same input given, /// returns an empty list if no responces have that input /// </returns> public static List <Responce> GetSomeResponces(string input, ChatbotContext context) { List <Responce> res = (from r in context.Responce where r.Input == input orderby r.Input select new Responce { ResponceID = r.ResponceID, Input = r.Input, Output = r.Output }).ToList(); context.SaveChanges(); return(res); }
public ActionResult GetAllContactDetails() { ChatbotContext cb = new ChatbotContext(); var chatbotResult = (from a in cb.ContactInfromation select new { a.id, a.name, a.phoneNumber, a.website, a.email, a.Address, }).ToList(); return(Json(new { ContactInfromation = chatbotResult }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetAllQuestionDetails() { ChatbotContext cb = new ChatbotContext(); var chatbotResult = (from a in cb.ChatBot select new { a.ContactId, a.Desc, a.IsHeader, a.LevelId, a.ParentId, a.QID }).ToList(); return(Json(new { QuestionMaster = chatbotResult }, JsonRequestBehavior.AllowGet)); }
public ChatBotController(ChatbotContext dbContext) { context = dbContext; }
public WatsonController(ChatbotContext context, IOptions <AppSettings> appSettings) { _appSettings = appSettings; _context = context; }