コード例 #1
0
        public void SeedFAQ()
        {
            try
            {
                var question1 = new FAQ {
                    Question = "What is ToDoList?", Answer = "ToDoList is a Web App for web site content and projects managing."
                };
                var question2 = new FAQ {
                    Question = "Is this available to my country?", Answer = "You can use ToDoList in all countries around the world, at your own risk."
                };
                var question3 = new FAQ {
                    Question = "How do I use the features of ToDoList App?", Answer = "If you want to use ToDoList, you need Azure or any other variant for SQL database and deploying. The code needed you can download from <a href=\"https://github.com/elvyra/ToDoList.git\" target=\"_blank\">GitHub repository</a>."
                };
                var question4 = new FAQ {
                    Question = "How much do the ToDoList App cost?", Answer = "ToDoList is absolutely free for all purposes (personal, learning and comercial). It was created for learning purposes, so be aware of using it on big data projects. We will appreciate your feedback and error reports, if any occours."
                };
                var question5 = new FAQ {
                    Question = "I have technical problem, who do I email?", Answer = "If you have any question, problem, offer or suggestion, please, contact us via facebook or linked (see the links at the bottom of the page)."
                };
                _context.AddRange(question1, question2, question3, question4, question5);

                _context.SaveChanges();
                _logger.LogInformation("Demo FAQ seeded to database.");
            }
            catch (Exception error)
            {
                _logger.LogError($"Demo FAQ seeding throw an exception. Error: ${error.Message}");
            }
        }