Exemple #1
0
        public Thread NewThread(Thread thread)
        {
            var newThread = _dbContext.Threads.Add(thread);

            _dbContext.SaveChanges();
            return(_dbContext.Threads.Where(t => t.ThreadId == thread.ThreadId).FirstOrDefault());
        }
Exemple #2
0
        public User Register(User newUser)
        {
            var newUser1 = _dbContext.Users.Add(newUser);                                 // addd the new user to the Db

            _dbContext.SaveChanges();                                                     // save the change.
            return(_dbContext.Users.FirstOrDefault(u => u.Username == newUser.Username)); // default is null
        }
Exemple #3
0
        /// <summary>
        /// This method will add a haiku line to the database and then return the
        /// newly create haiku line back
        /// </summary>
        /// <param name="haikuline"></param>
        /// <returns></returns>
        public HaikuLine SaveLine(HaikuLine haikuline)
        {
            var newLine = _dbContext.HaikuLines.Add(haikuline);//add the new line to the database

            _dbContext.SaveChanges();
            return(_dbContext.HaikuLines.FirstOrDefault(h => h.HaikuLineId == haikuline.HaikuLineId));
        }