Beispiel #1
0
        protected void UpdateSnsUser(IDbConnection conn, IDbTransaction trans, SnsUser user)
        {
            if (SnsUserHelper.Exists(conn, trans, user.Id))
            {
                var sql = "update T_SnsUsers set Introduction=@Introduction,FriendValidate=@FriendValidate,AllowComment=@AllowComment where UserId=@Id";
                conn.Execute(sql, user, trans);
            }
            else
            {
                var sql = "insert into T_SnsUsers(UserId,Introduction,FriendValidate,AllowComment) values(@Id,@Introduction,@FriendValidate,@AllowComment)";
                conn.Execute(sql, user, trans);
            }

            UpdateUser(conn, trans, user);
        }
Beispiel #2
0
 public Result UpdateAvatar(string id, string avatar)
 {
     return(connection.Transaction("修改", (conn, trans) =>
     {
         var param = new { Avatar = avatar, Id = id };
         if (SnsUserHelper.Exists(conn, trans, id))
         {
             var sql = "update T_SnsUsers set Avatar=@Avatar where UserId=@Id";
             conn.Execute(sql, param, trans);
         }
         else
         {
             var sql = "insert into T_SnsUsers(UserId,Avatar) values(@Id,@Avatar)";
             conn.Execute(sql, param, trans);
         }
     }));
 }