Beispiel #1
0
        public static void Initialize(TwitterishContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.Tweets.Any())
            {
                return;   // DB has been seeded
            }

            var tweets = new Tweet[]
            {
            };

            foreach (Tweet s in tweets)
            {
                context.Tweets.Add(s);
            }
            context.SaveChanges();

            var commands = new Command[]
            {
                new Command {
                    KeyCommand = "hi", ResponseClass = "Hi"
                },
                new Command {
                    KeyCommand = "clear", ResponseClass = "Clear"
                },
                new Command {
                    KeyCommand = "empty", ResponseClass = "Empty"
                },
                new Command {
                    KeyCommand = "line-break", ResponseClass = "LineBreak"
                },
                new Command {
                    KeyCommand = "tweet", ResponseClass = "NewTweet"
                },
            };

            foreach (Command c in commands)
            {
                context.Commands.Add(c);
            }
            context.SaveChanges();
        }
 public CommandController(TwitterishContext context)
 {
     _context = context;
 }
Beispiel #3
0
 public TweetController(TwitterishContext context)
 {
     _context = context;
 }