/// <summary>
 /// adds the new tweet.
 /// </summary>
 /// <param name="tweet">tweet</param>
 public bool AddTweet(Tweets tweet)
 {
     using (var dbContext = new TweetAppUseCaseContext())
     {
         dbContext.Tweets.Add(tweet);
         var result = dbContext.SaveChanges();
         return(result > 0);
     }
 }
 /// <summary>
 /// registered the new user
 /// </summary>
 /// <param name="userRegister">user details.</param>
 public bool UserRegister(Users userRegister)
 {
     using (var dbContext = new TweetAppUseCaseContext())
     {
         dbContext.Users.Add(userRegister);
         var result = dbContext.SaveChanges();
         return(result > 0);
     }
 }
 public bool ForgotPassword(string emailId, string newPassword)
 {
     using (var dbContext = new TweetAppUseCaseContext())
     {
         var userDetails = dbContext.Users.Where(s => s.EmailId == emailId).FirstOrDefault();
         if (userDetails != null)
         {
             userDetails.Password = newPassword;
             dbContext.Update(userDetails);
             var result = dbContext.SaveChanges();
             return(result > 0);
         }
         return(false);
     }
 }
        /// <summary>
        /// updates the password.
        /// </summary>
        /// <param name="userId">Userid.</param>
        /// <param name="newPassword">Newpassword.</param>
        /// <returns></returns>

        public bool UpdatePassword(string userId, string oldPassword, string newPassword)
        {
            using (var dbContext = new TweetAppUseCaseContext())
            {
                var userDetails = dbContext.Users.Where(x => x.EmailId == userId && x.Password == oldPassword).FirstOrDefault();
                if (userDetails != null)
                {
                    userDetails.Password = newPassword;
                    dbContext.Users.Update(userDetails);
                    var created = dbContext.SaveChanges();
                    return(created > 0);
                }

                return(false);
            }
        }