public Page <MessageView> GetMessages(int pageIndex, int pageSize, MessageStatus?status = null) { var sql = Sql.Builder.Where("receiver_id=@0", this.ID); if (status.HasValue) { sql.Where("status=@0", (int)status.Value); } return(MessageView.Page(pageIndex, pageSize, sql)); }