示例#1
0
        public List <MessageFullModel> GetOldMessagesByUserId(int userId)
        {
            string sql = "select m.*, u.UserName from dbo.Messages m " +
                         "left join dbo.Users u on m.FromUserId = u.Id " +
                         "where ToUserId = @ToUserId and IsRead = 1;";

            List <MessageFullModel> messages = _db.LoadData <MessageFullModel, dynamic>(sql, new { ToUserId = userId }, connectionStringName);

            return(messages);
        }
示例#2
0
        public (bool, int) ConfirmUserAndPassword(string userName, string password)
        {
            string sql = "select * from dbo.Users where UserName = @UserName";

            List <UserModel> matchingUsers = _db.LoadData <UserModel, dynamic>(sql,
                                                                               new { UserName = userName },
                                                                               connectionStringName);

            if (matchingUsers.Count > 0)
            {
                UserModel user = matchingUsers.First();

                (bool, int)result = ConfirmPasswordHashAndReturnUserId(user, password);

                return(result);
            }
            else
            {
                return(false, -1);
            }
        }